Hello,
I decided that I use paperclip to handle my images.
I have this model for posts
class Micropost < ActiveRecord::Base
attr_accessible :content, :user_id
belongs_to :user
end
So according to the manual I have to do this :
has_attached_file :photo
But :photo is never used anywhere.
So do I have to change something or did I misunderstand the manual.
Roelof
Hi…
- in Gemfile add this gem
gem “paperclip”, “3.1.4”
- bundle install
3.after creating model add below code in migration file(db->migrate->photo model migration file )
t.attachment:photo
-
rake db:migrate
-
in your model Add this code
attr_accessible: photo
has_attached_file :photo
:path=>“rails_root/public/system/:attachment/:id/:style/:filename”,
:url=> “system/:attachment/:id/:style/:filename”