new on rails, i am having problem in passing select_tag value(in the view file) to controller.
my view controller file is 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 is like
<% form_tag("project_status", :controller => "ProjectStatus", :action => "show", :method=>'get' ) do %> <%= select_tag 'project', options_from_collection_for_select(@projects,"id", "name"),:onchange => "this.form.submit();" %> <% end %> <% if !@rows.nil? @rows.each do |row| end %> <%= row[:name] %> <% end %>
what i basically want to achieve is this - based on the selected value from select tag i want to display information(on the same view page) of selected item from the database