I have a scaffold generated list. When user selects an item ( clicks on
''show''), I want to display a list filtered by that selected
''id''. Instead I
get this syntax error:
app/controllers/voice_circuits_controller.rb:12: syntax error
@voice_circuit_pages, @voice_circuits = paginate
:voice_circuit_for_location(@params[:vwlocation]), :per_page => 25
^
app/controllers/voice_circuits_controller.rb:12: syntax error
@voice_circuit_pages, @voice_circuits = paginate
:voice_circuit_for_location(@params[:vwlocation]), :per_page => 25
These are the changes I''ve made to the scafflold generated code:
in Childs model file: ( voice_circuits ), added this def:
def self.for_location(location)
self.find {:all, :conditions => ''location_id = location''}
end
----
In the Parents list.rhtml file I changed the ''show'' link to:
def show
@vwlocation = Vwlocation.find(params[:id])
redirect_to :controller => ''voice_circuits'', :action =>
''list_for_location''
end
----
Finally, in the child''s controller ( voice_circuits_controller.rb),
added a
list_for_location def.
def list_for_location
@voice_circuit_pages, @voice_circuits = paginate
:voice_circuit_for_location(@params[:vwlocation]), :per_page => 25
end
----
I will be doing this sort of thing often in this project. I''d like to
get it
right, before I go further.
Thanks the help.
--
Best Regards,
-Larry
"Work, work, work...there is no satisfactory alternative."
--- E.Taft Benson
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails