I managed to get this working by using an OStruct and having all the filters
be dynamic attributes of it.. but it''s odd that there isn''t a
way to use the
FormOptionsHelper without it expected an object to set the value on (rather
than being passed the value itself as an option).
On Friday 25 March 2005 19:47, Luke Galea wrote:> Hi All,
>
> I''m a newbie.. and I''m trying to add a series of selects
to the bottom of a
> scaffolded "list" to act as filters.. (so: to filter for elements
with
> field YADA equal to WHATEVER)..
>
> I''d like to use select from FormOptionsHelper, but the docs and
all
> examples seem to imply that it needs to set a value in an existing object..
> in this case I really just want the controller to have a series of member
> variables that are the filters (ie: @submitted_filter).
>
> The code below I added to the list.rhtml and of coarse.. it
doesn''t work
> because it''s trying to set to_s= to the selected value I think..
>
> <%= start_form_tag :action => ''list'' %>
> <p><label>Submitted</label><%= select
''submitted_filter'', ''to_s'',
> SubmissionsController.SubmittedFilterOptions %>
> <input type="submit" value="Filter" /></p>
> <%= end_form_tag %>
>
> and I added the following to the list method in the controller:
> @submitted_filter = @params[''submitted_filter''] ||
''''
>
> Am I going about this entirely wrong? Thanks in advance for any help!!