On 11 March 2011 15:01, Sebastian <[email protected]> wrote: > Yes that is exactly what I want. > > OK , I copied my file in the models folder and I guess I need to > create the form in my view with a "form_tag", or? Or do I need the > "form_for"? > > My problem is that I don't really know what I have to put in the > controller and my view (form) to call my model?
You don't *need* anything in your form.. it could just be a plain ol' HTML form submitting to the URI of your controller. In the controller, the params hash will have all the values from the submitted form - so if you have a text input field named "request_to_run", you'll have a params value: params[:request_to_run] ...so you can do: my_request = Request.new(params[:request_to_run]) (use debugging to confirm all the params values, etc, as I'm writing this off the top of my head! :-) In the controller action, populate "@results" with the results of your model (BTW, I wouldn't call it "Request"... that's a reserved word in Rails. @results = my_request.groovy_method_that_does_some_work in your view you can conditionally draw it: <%=h @results.inspect if @results %> On the whole though, if this is all you want your Rails app to do, then Rails is a bit of overkill. You'd (with your pure Ruby experience) probably find Sinatra makes more sense for such a requirement. Either way, Rails will do it too - it just loads up loads of other functionality you're never going to use :-) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

