Drahcir
Drahcir

Reputation: 12621

Rails PaperClip `method_missing': undefined method `has_attatched_file'

I am encountering an error involving PaperClip at runtime. I have followed the instructions as stated by the Paperclip github page. Details involving paperclip are stated below. Is there something I might have missed?

Error Log

/usr/local/rvm/gems/ruby-2.1.5@rails4/gems/activerecord-4.1.6/lib/active_record/dynamic_matchers.rb:26:in 'method_missing': undefined method 'has_attatched_file' for Vehicle (call 'Vehicle.connection' to establish a connection):Class (NoMethodError)

Enviroment

vehicle.rb

class Vehicle < ActiveRecord::Base
  has_attatched_file  :main_photo, :styles => { :medium => "300x300>", "thumb" => "100x100>" }, :default_url => "/images/:style/missing.png" 
  validates_attatchment_content_type :main_photo, :content_type => /\Aimage\/.*\Z/   
end

Gemfile

gem "paperclip", "~> 4.3"

Upvotes: 0

Views: 515

Answers (1)

knrz
knrz

Reputation: 1811

You've got a typo dude. You need has_attached_file instead of has_attatched_file.

class Vehicle < ActiveRecord::Base
  has_attached_file  :main_photo, :styles => { :medium => "300x300>", "thumb" => "100x100>" }, :default_url => "/images/:style/missing.png" 
  validates_attatchment_content_type :main_photo, :content_type => /\Aimage\/.*\Z/   
end

Upvotes: 1

Related Questions