Displaying 13 results from an estimated 13 matches for "role_names".
Did you mean:
role_name
2008 Jul 06
1
ActionView::Base.field_error_proc not getting an error field
In my User form I have standard field to get user record attributes
(first_name, last_name and email)
I also have a select drop_down to choose a role from an array
first_name, last_name and email are user record attributes, but I
defined the role name as a virtual attribute
validates_presence_of :email, :last_name
attr_accessor :role_name
validates_presence_of :role_name, :if
=>
2006 Apr 09
6
Write/Display AR query as Grouped Results?
I''ve got a publications table that contains an author_id foreign key and
a pubrole_id foreign key. What I want to do is query the DB using AR so
that I can get a list of all publications that belong_to a particular
author, and group the results by the pubrole.role_name (Author, Joint
Author, Editor, etc.) so that the results look something like:
Author
book1 info
book2 info
etc.
2009 May 12
4
has_many :through and scopes: how to mutate the set of associated objects?
I have a model layer containing Movie, Person, Role, and RoleType,
making it possible to express facts such as "Clint Easterbunny is
director of the movie Gran Milano".
The relevant model and associations look like this
class Movie < ActiveRecord::Base
has_many :roles, :include => :role_type, :dependent => :destroy
has_many :participants, :through => :roles, :source
2008 Feb 01
0
find_with_ferret and HABTM assocs
Could you be more specific about what is not working?
-- Are your association methods between Role and User being set up
correctly? (If not, make sure your statement is
"has_and_belongs_to_many", and not "hasandbelongstomany".)
-- Are you storing the data for role_name in the index? If so, can
you see it there?
I''m not familiar with the find_with_ferret
2008 May 21
8
before_filter with multiple roles
I have multiple roles in my application.
Now I want to block a method for all users except the administrator and
a manager.
When I do this:
before_filter (:check_administrator_role), :only => [:administration]
before_filter (:check_taskmanager_role), :only => [:administration]
The user must have both roles. How can I change that to an "OR"
combination?
--
Posted via
2009 Jan 27
2
Login form_tag with select_tag option
Hi all,
In the application i develop, a sophisticated login system is required.
Being a newbie in Ruby, i''m not comfortable with the select tag in the
form tag.
My requirement:
2 tables - User(LoginName, Password, RoleId...) and Role(RoleId,
RoleName...)
View - RoleNames to be loaded in the drop down box and On submit, RoleId
to be passed to controller for authentication.
My Code
2008 May 02
1
names of select elements inside a fields_for block not generated as expected
..._for ''project[proj_people_attributes][]'', pp do |pp_form|
%>
<p>
Person:
<%= collection_select(:pp, :person_id, Person.get_list, :id,
:nom, {:prompt => ''Person?''}) %>
Role:
<%= select(:pp, :role, Person::ROLE_NAMES, {:prompt => ''Role?''})
%>
</p>
<% end %>
<% end %>
<% end %>
I get the expected series of 3 <select>s, but their names are not
automatically indexed. So I get:
<select id="pp_person_id" name="pp[person_id]&quo...
2011 Mar 14
1
slight security problem
Hey,
Just wondering if anyone else has noticed this.
I''m using thin+puppetmasterd+nginx. If i add a host, sign it''s key,
run puppetd successfully on it all is good, as expected. If i then
revoke/clean the key on the master server, leave the box running,
startup another host set the hostname to be the same as the old,
generate new keys/have them signed. The original box is still
2006 Feb 15
4
problem with saving id''s in a join table
hello,
I''am new to ROR and I have a problem.
I have to models "rights" and "roles" on a has_and_belongs_to_many
relationship, through "roles_rights" table. When I try to add a new role
although I put in my form fields for each right, a record is added to
table roles but none to roles_rights.
I am using Ruby 1.8.4 rails 1.0 mysql 5.0
here is my code:
2007 Jul 24
6
Mocking Access Control
I''m trying to jump on the TDD/BDD bandwagon, but am having trouble
understanding how i should mock my user. The user has a habtm
relationship to a roles model (acl_system2 plugin), but I''m not sure
how to tell rspec about a model.
My code:
describe UsersController do
integrate_views
before(:each) do
@user = mock_model(User)
2006 Aug 18
9
Rails is doing what I want - but I don''t understand how.
...r
end
create_table :roles do |t|
t.column "name", :string
end
end
def self.down
drop_table :roles_users
drop_table :roles
end
end
As you can see I wrote a self.names methods so that I can easily call
all the names out of the roles table like so:
>> role_names = Role.names
=> ["trainers","admins"]
So that makes perfect sense.
So the weird but cool part, is that when I go to grab all the names of
the roles that belong to a user like so:
>> user = User.find :first
=> #<User:0x25cd680 @attributes={"id"=>&q...
2009 Jul 02
1
Rails Select Helper
Dear All,
I m using the below select helper for my select helper which works fine.
<%=privilege. select :AC,Role.find(:all,:conditions => {:role_type =>
"AC"}).collect {|c| [ c.role_name, c.id ] },{},{:class => "txtbox"} %>
Its generates the below html...
<select name="privilege[AC]" id="privilege_AC" class="txtbox">
2010 Nov 30
4
Cucumber+Capybara rails 3 issue (Don't know where exactly)
When I''m executing cucumber tests, I noticed that sometimes rails app
(in test env.) getting several the same requests (GET or POST) usually
around 3, and it doesn''t render anything with empty HTTP status code.
Have anyone met something similar to that issue?
here is some example of log file:
Started POST "/account" for 127.0.0.1 at 2010-11-30 22:34:17 +0200