Forum: Ruby on Rails paperclip gem question.

Posted by Roelof Wobben (roelof)
on 2012-10-06 17:41
(Received via mailing list)
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
Posted by BalaRaju Vankala (Guest)
on 2012-10-07 12:36
(Received via mailing list)
Hi...
1.  in Gemfile add  this gem

gem "paperclip", "3.1.4"

2. bundle install
3.after creating model add below code in migration 
file(db->migrate->photo
model migration file )

t.attachment:photo

4. rake db:migrate

5. 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"




On Sat, Oct 6, 2012 at 9:10 PM, roelof <rwobben@hotmail.com> wrote:

>
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscribe@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-....
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



--
నేను
కొంచం తపన,
 కాస్త ఆసక్తి,
కొన్ని కలలు,
 కాసిన్ని ఊహలు కలిపేస్తే
 నేను
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.