There are many things going on here, but here are a few pointers.
First, <%= check_box_tag "photo_ids[]", p , true%>
should be <%= check_box_tag "photo_ids[]", p.id , true%>
The id that will be returned here being the Unsplash photo id.
Second, since you used p, what you receive in the params[:photo_ids] is an array of strings. Even though it looks like the fingerprint of the object, it's not the object anymore but its fingerprint.
So when you call params[:photo_ids][1].save, you're calling save on a string (the string representation of the object, "#Photo:0x00007f961bb58278").
Hence the error NoMethodError Exception: undefined methodsave' for "#Photo:0x00007f961bb58278":Stringwhich tells you that there is nosave` method for String objects.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
There are many things going on here, but here are a few pointers.
First,
<%= check_box_tag "photo_ids[]", p , true%>
should be
<%= check_box_tag "photo_ids[]", p.id , true%>
The id that will be returned here being the Unsplash photo id.
Second, since you used p, what you receive in the params[:photo_ids] is an array of strings. Even though it looks like the fingerprint of the object, it's not the object anymore but its fingerprint.
So when you call
params[:photo_ids][1].save
, you're calling save on a string (the string representation of the object, "#Photo:0x00007f961bb58278").Hence the error
NoMethodError Exception: undefined method
save' for "#Photo:0x00007f961bb58278":Stringwhich tells you that there is no
save` method for String objects.