Hi Martyn,
Martyn Elmy-liddiard wrote:
Obviously my Model code is wrong
No offense intended, but there're problems with all your code.
<form action="/risk/liststatus2"> Status <input type="text" name="Status" size="20"><p> <input type="submit"> </form>
You're hardcoding your form instead of using eRb. Rails will have a hard time figuring out what you're asking it to do. You'll need to decide whether you want your params bound to a model or not: text_field vs. text_field_tag.
> In the Risk Controller I have the following Code:-
def liststatus2 @found = Risk.liststatus2 end
Params get passed back to the controller in a hash. In the case above, the value is coming back in a param you'd address like:
@found = params[:Status]
and finally in the Model I have the following code:- def self.liststatus2 find(:all, :conditions => "Status = ?", @Status) end
The value is in @found.
hth, Bill