search for: role_name

Displaying 13 results from an estimated 13 matches for "role_name".

2008 Jul 06
1
ActionView::Base.field_error_proc not getting an error 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 => :role_name_required?, :message => ''must be selected'' when testing with a blank form, I get all errors detected during User model validation, which is fine... BUT ActionView::Base.field_error_proc doesn''t get the role...
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. Joint Author book1 info book2 info Editor etc. Can anyone suggest how to do this, or point to an example that already exists? Thanks. -- Posted via http://www.ruby-forum...
2009 May 12
4
has_many :through and scopes: how to mutate the set of associated objects?
...erbunny 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 => :person do def as(role_name) self.scoped( :joins => ''CROSS JOIN role_types'', :conditions => [ "(roles.role_type_id = role_types.id) + " AND role_types.name = ?", role_name ] ) end end ... end Querying is easy: m...
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 method (because I use index.search_each). However, in my code I do have a case where I do something like your role_name method, and the output gets indexed. --Paul Rolf Guescini wrote: > Hi...
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
...params[:login]) validUser = User.find(:first,:conditions => ["login_name = ? and password = ? and role_id = ?",@user.logname, @user.password, @user.roleid]) if validUser @role = Role.find(:first, :conditions => ["id = ?", @user.roleid]) if @role.role_name == "Admin" session[:admin] = validUser.id redirect_to :controller=>''admins'', :action => ''index'' else session[:user] = validUser.id redirect_to :controller=>''projects'', :action =&...
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]&qu...
2011 Mar 14
1
slight security problem
...$ssl_client_s_dn; proxy_set_header X-SSL-Issuer $ssl_client_i_dn; proxy_read_timeout 65; location / { proxy_pass http://puppet-production; } } </code> and here is how i start puppetmasterd: /usr/bin/thin start -P /var/run/puppet/$ROLE_NAME.pid -e production -- servers 5 --daemonize --socket /var/run/puppet/$ROLE_NAME.sock -- chdir /etc/puppet/ --user puppet --group puppet -R /etc/puppet/ config.ru With the contents of config.ru being: <code> $0 = "puppetmasterd" ARGV << "--rack" require ''pup...
2006 Feb 15
4
problem with saving id''s in a join table
...e flash[:notice] = ''Role was successfully created.'' redirect_to :action => ''list'' else render :action => ''new'' end end ============================ view: ============================ <p><label for="role_name">Name</label><br/> <%= text_field ''role'', ''name'' %></p> <div><label for="role_right">Rights</label><br/> <ul> <% for right in @rights %> <li><input type="checkbox&quo...
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"=>&...
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"> <option value="4">Trainees</option> <option value="8">Test Group Role</...
2010 Nov 30
4
Cucumber+Capybara rails 3 issue (Don't know where exactly)
...uot;, "people"."first", "people"."last", "people"."entity_id", "people"."user_id" FROM "people" WHERE ("people".user_id = 1061) LIMIT 1 UserRole Load (6.1ms) SELECT DISTINCT "user_roles".role_name FROM "user_roles" WHERE ("user_roles".user_id = 1061) SQL (1.5ms) UPDATE "users" SET "emails_delivery_period" = ''--- :daily_logs: :immediately :homework: :immediately :events: :immediately :signups: :immediately :polls: :immediately :attachments:...