ruby on rails - How do you use an attr_accessor in a select form? -


I am trying to capture the identity of a gallery so that I can create a base That special gallery

So I put together a selection form, and threw an attr_accessor in my controller.

But it is the reason of failing from all its directions, and I understand its problem, is my address any kind of address?

Model

  attr_accessor: existing_gal  

controller

View

Code> - form_for @gallery do | F | = Select @ Gallery, @exising_gal, options_for_select (@ galleries.collect {| g | g.name}), {} ,: class = & gt; "Gallery_title" = link_to 'Add Photo', new_photos_organization_media_gallery_url (@ organization.id, @ existing_gal.id) ,: class = & gt; 'Button' add_photos_btn '

1 - I think that you understand the meaning of the attr_accessor please read it.

2 - I do not think of code that you have ever exported @ to do anything.

If you are trying to create a form to start a new gallery with this

  - form_for @gallery do | F |  

The reason for this is that you are creating a form for a new gallery, which is actually @ Gallery, see the controller for the gallery. New.

Hope this help is please comment if I misunderstood your plight.


Comments