ruby - trouble in passing select tag values in a rails application -



ruby - trouble in passing select tag values in a rails application -

new on rails, having problem in passing select_tag value(in view file) controller.

my view controller file like

class projectstatuscontroller < applicationcontroller def index @projects = project.find(:all, :select => "name") end def show lookup = params[:project] @rows = project.find_by_lookup(lookup) end end

and view file like

<% form_tag("project_status", :controller => "projectstatus", :action => "show", :method=>'get' ) %> <%= select_tag 'project', options_from_collection_for_select(@projects,"id", "name"),:onchange => "this.form.submit();" %> <% end %> <% if !@rows.nil? @rows.each |row| end %> <%= row[:name] %> <% end %>

what want accomplish - based on selected value select tag want display information(on same view page) of selected item database

first of should write <%= form_tag not <% form_tag

than, it's unusual extract select field id(options_from_collection_for_select(@projects,"id", "name"))

but in method show search record field lookup

ruby-on-rails ruby ruby-on-rails-3

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -