Paperclip gem question

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…

  1. in Gemfile add this gem

gem “paperclip”, “3.1.4”

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

t.attachment:photo

  1. rake db:migrate

  2. 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 [email protected] wrote:

You received this message because you are subscribed to the Google G.
“Ruby on Rails: Talk” group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
To view this discussion on the web visit
https://groups.google.com/d/msg/rubyonrails-talk/-/is2_0907w1QJ.
For more options, visit https://groups.google.com/groups/opt_out.


నేను
కొంచం తపన,
కాస్త ఆసక్తి,
కొన్ని కలలు,
కాసిన్ని ఊహలు కలిపేస్తే
నేను

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs