Look on below situation:
class User < ActiveRecord::Base
has_one :profile, :autosave => true
end
class Profile < ActiveRecord::Base
belongs_to :user
has_attached_file :picture,
:styles => { medium: "300x200>", thumb: "100x100>" },
:storage => :s3,
:s3_credentials => Proc.new{|a|
a.instance.s3_credentials}
validates_attachment_content_type :picture, content_type:
/\Aimage\/.*\Z/
end
this two class + paperclip and that's enough. I think You don't need
extra model for keeping user profile picture, you can easily add column
"picture" in Your Profile model.
W dniu 22.01.2016 o 11:20, fugee ohu pisze:
On Friday, January 22, 2016 at 5:16:55 AM UTC-5, Colin Law wrote:
On 22 January 2016 at 04:16, fugee ohu <fuge...@gmail.com
<javascript:>> wrote:
> This form raises undefined method `pictures_path' for
> #<#<Class:0xaea3ad0>:0xbb9cb4c>
>
> <%= form_for(@picture, :html => { :multipart => true }) do |f| %>
Have you defined that route in routes.rb (via resources: pictures
for example)?
I agree with Przemek that you would probably be better off using
paperclip for uploading. It makes life very easy.
Colin
I wouldn't disagree Here's the route: post
'users/:id/profiles/:id/pictures/new' => 'pictures#new'
--
You received this message because you are subscribed to the Google
Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to rubyonrails-talk+unsubscr...@googlegroups.com
<mailto:rubyonrails-talk+unsubscr...@googlegroups.com>.
To post to this group, send email to rubyonrails-talk@googlegroups.com
<mailto:rubyonrails-talk@googlegroups.com>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/23941c73-ce4d-4423-9f3d-be963bd4c363%40googlegroups.com
<https://groups.google.com/d/msgid/rubyonrails-talk/23941c73-ce4d-4423-9f3d-be963bd4c363%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Ruby on
Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/56A2041D.8020302%40gmail.com.
For more options, visit https://groups.google.com/d/optout.