I want to be able to edit the uploaded images from attachment_fu. In my view I do something like this: <p> <b>Cover</b><br /> <%= f.file_field :cover %> </p> and then in my controller, I do something like @book = Book.new(params[:book].except(:author_ids, :cover)) if !params[:book][:cover].instance_of? String @cover = Cover.create!(:uploaded_data => params[:book][:cover], :book_id => @book.id) end I just wanted to know if this is the best way to do this or if there is something I am missing -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You''ll want to save the book first so that @book.id will exist. Other than that, I''m not really sure what you mean about being able to edit the images. Are you getting a particular error? On May 12, 3:41 pm, Matt Mongeau <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I want to be able to edit the uploaded images from attachment_fu. In my > view I do something like this: > > <p> > <b>Cover</b><br /> > <%= f.file_field :cover %> > </p> > > and then in my controller, I do something like > > @book = Book.new(params[:book].except(:author_ids, :cover)) > if !params[:book][:cover].instance_of? String > @cover = Cover.create!(:uploaded_data => params[:book][:cover], > :book_id => @book.id) > end > > I just wanted to know if this is the best way to do this or if there is > something I am missing > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
JDevine wrote:> You''ll want to save the book first so that @book.id will exist. > > Other than that, I''m not really sure what you mean about being able to > edit the images. > > Are you getting a particular error? > > On May 12, 3:41 pm, Matt Mongeau <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>Sorry, I forgot to mention that I am saving. I am not getting any errors, I just wasn''t sure if there was a better way. What I mean by editing the images is I want to be able to create the Book with or without an image and update the image at any time. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---