Displaying 2 results from an estimated 2 matches for "view_role_rights".
2006 Apr 06
1
drop down menu - getting @params[:id] value.
..."name")
in my view I have:
<%= collection_select(:id, :name, @roles, :id, :name) %> role <%=
submit_tag("Go") %>
I cannot get just the id of the selected option. If i inspect the params
I get:
{"commit"=>"Go", "action"=>"view_role_rights", "id"=>{"name"=>"1"},
"controller"=>"accounts"}
What is going on there? can anyone help?
--
Posted via http://www.ruby-forum.com/.
2006 Apr 07
0
HABTM query return all results
...; ActiveRecord::Base
has_and_belongs_to_many :employees
has_and_belongs_to_many :rights
end
I have tried and using the following I can get a list of all the rights
associated with the current role (I think there must be an easier way,
The AWDWR book does not explain this type of query):
def view_role_rights
role = Role.find_by_id(1)
@rights = Right.find(:all, :conditions => [%{rights.id =
rights_roles.role_id = ?},role.id ], :joins => '', rights_roles'' )
end
I want to be able to say "get me all the rights, highlight to the rights
that are associated with the role...