未定义的方法`bson_type' for ActionDispatch :: Http :: UploadedFile

时间:2014-06-12 06:05:07

标签: ruby-on-rails mongoid paperclip

我正在尝试使用' mongoid-paperclip'更新徽标。但它显示以下错误:

undefined method `bson_type' for #<ActionDispatch::Http::UploadedFile:0x007f781859ae60> 

这是我的控制人员:

def update
respond_to do |format|
  clinics  = Clinic.where(:id => doctor_clinic_params[:doc_clinic_id])
  clinics.update(:clinic_logo => doctor_clinic_params[:clinic_logo])

  if @doctor_clinic.update(doctor_clinic_params)
    format.html { redirect_to doctor_clinics_path, notice: 'Doctor clinic was successfully updated.' }
    format.json { head :no_content }
  else
    format.html { render action: 'edit' }
    format.json { render json: @doctor_clinic.errors, status: :unprocessable_entity }
  end
end

def doctor_clinic_params
  params.require(:doctor_clinic).permit(:crop_x, :crop_y, :crop_w, :crop_h,:clinic_extension_number,:clinic_logo,:doc_clinic_id, :hospital_id, :clinic_phone_no, :address, :clinic_name  ] )
end

这是我的模特:

class Clinic
  include Mongoid::Document
  include Mongoid::Timestamps
  include Mongoid::Paperclip

  has_mongoid_attached_file :clinic_logo, 
  :path => ":rails_root/public/system/:attachment/:id/:style/:filename",
  :url => "/system/:attachment/:id/:style/:filename",
  :styles  => { :small => "50x50", :large => "304x304" }


  field :clinic_name, type: String

  field :clinic_extension_number, type: String

  field :address, type: String
  field :clinic_phone_no, type: String
  field :available_days, type: Array


  belongs_to :doctor_clincs
  has_and_belongs_to_many :doctors

end

0 个答案:

没有答案