My site is for posting album reviews, which are called Pins. The pins
model has the following attributes:
:artist, :year, :title, :rank, :description, and :image
The image uses Paperclip and is stored on Amazon S3 if that matters
I am trying to allow a user to see a review that another user posted and
click a link to more simply write their own review for that same album.
So basically the link takes them to the Pin.new page and the form
already has the :artist, :title, :image, and :year filled in.
I figured out how to do it while bringing all of the attributes that I
want, but the image doesn't come over to the new form.
Here is the pins_controller.rb code I'm using, which gives me an error
of "no implicit conversion of URI::Generic into String":
def copy
@source = Pin.find(params[:id])
@image = URI.parse(@source.image.url)
@pin = Pin.new(artist: @source.artist, album: @source.album, year:
@source.year, image: @image)
render 'new'
end
And in my show view:
<%= link_to "copy", copy_pin_path(params[:id]) %>
Attachments:
http://www.ruby-forum.com/attachment/10385/Screen_Shot_2015-01-08_at_1.39.06_PM.png
--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@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/77b48a12e877bfd3fb9743a0720376d5%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment