Relatively new to Ruby but sticking with it, however I really need some
help on passing parameters.
I have a table of risks with a status field (values = Open Closed or
I have a view where user can enter the Status they wnat to retrieve all
matching records for. View Code:-
In the Risk Controller I have the following Code:-
@found = Risk.liststatus2
and finally in the Model I have the following code:-
find(:all, :conditions => “Status = ?”, @Status)
Obviously my Model code is wrong since if I use the following code:-
find(:all, :conditions => “Status = ‘Open’”)
i.e. hard-coding the value ‘Open’ then it works fine.
So, in short, can someone please advise the syntax for passing the
Status parameter into the model to retrieve the records the user wants.
I have spent alot of time trying to sort this and learned alot of other
useful stuff in the process…so I’m not just running for help straight
Having said that I really do need some assitance.
Any help gratefully recieved.