similar to: view code regular expression

Displaying 20 results from an estimated 300 matches similar to: "view code regular expression"

2006 Apr 16
6
still learning maintaining data with join tables
Class Role has_and_belongs_to_many :users Class User has_and_belongs_to_many :roles Class RolesUsers has_and_belongs_to_many :roles has_and_belongs_to_many :users According to the logs...I''m good through here @roles_users = RolesUsers.find(:all, :conditions => ["user_id = ?", params[:users_id]] ) the next section of controller code is a problem...
2008 Mar 23
1
radio buttons - how to identify record using value?
I''m making a simple questionnaire app using RoR. I''ve got a model for Questions, a model for Answers, and a third model, Qa, for matching each question to five possible answers through foreign keys. So, each qa has a question and five answers , a1-a5, through belongs_to and a :foreign_key, and then a selected_answer field for specifying which answer was selected by the user. The
2006 Jul 11
1
Problems using the authorization plugin from Bill Katz
Hello everyone, I was trying to set up access control in a new application Im working on, I''m trying to use the excellent authorization plugin from Bill Katz, Its pretty straight forward to setup and should be to use. But when i try to give the same permission on two differents users on the same object i get an error. (Well , Im kinda new to all this rails stuff) r = Red.find(1) u1 =
2006 Aug 18
9
Rails is doing what I want - but I don''t understand how.
Hi guys, I have the strangest thing happening. The funny part is its doing exactly what I want to do, I just don''t understand how. Basically here is my model. class Role < ActiveRecord::Base has_and_belongs_to_many :users has_and_belongs_to_many :rights def self.names names = Array.new() for role in Role.find :all names << role.name end return
2006 Jan 29
1
returned values and consequent usage
I think I can have finally reduced my problem to something somebody can help me with. I am using auto_complete... specifically the form command is... <%= text_area_auto_complete_for :case_manager :name %> I need to use the value derived here in my controller... If I use... cm = CaseManager.find(:first, :conditions => "name = ''Thomas E Dewey''") it works.
2006 Feb 06
3
linked table confusion
placement.rb has_one :client has_one :case_manager client.rb belongs_to :case_manager has_many :placements case_manager.rb has_many :clients has_many :placements I am trying to create a view file for placements. I can pull columns from clients table in this view by using... <%= @placement.client.wholename %> but if I use <% @placement.case_manager.wholename %>
2006 Jan 25
2
select list generated from table
Have 2 tables - clients & case_managers class Client < ActiveRecord::Base has_one :case_manager end app/views/clients/_form.html contains line... <p><% collection_select("client", "case_manager_id", \ case_manager.find_all, "name", "id") %></p> and this line generates error... undefined local variable or method
2006 Jan 30
3
general questions
Agile book lacks some basic information, perhaps I need to learn ruby as I am lacking information - some basic things - especially debugging. The following are stupid newbie questions and any portion of them answered would be great. 1. If I am viewing a page from app/views/clients/ and on this page, I want to put a ''link_to'' directive to say app/views/case_managers... how do I
2006 Apr 27
7
Role Based Authorization recipe implementation?
i got the rails recipes book, i have now an auth system for users without problems, now i want to made a role based acces for my app, im following the "Role Based Authorization" recipe of the book but i cant make it to work even when the tables created and correctly added data manually definig the roles and rights. als i dont know how to define a right for use all the actions in a
2006 Jan 30
5
Lookup from related tables
I have been working on this for 3 days and haven''t been able to solve it. I have 2 tables... clients belongs_to: case_managers case_managers has_many: clients When entering new clients, I need to have some type of select box that allows me to pick the case_manager (by name) so that the ''id'' field from the case_manager table is inserted into clients.case_manager_id
2006 Mar 25
1
foreign keys on migration
I have reached a development plateau and now want to integrate some of the rails niceties that I passed over to get the system online. I am fooling with migrations. I am using postgresql. I put in my migration script (at the end of the ''up'' method, the following raw sql code... # set up primary key restratints for PostgreSQL execute ''ALTER TABLE ONLY
2006 Sep 05
0
rake craziness with Migrate as a dependency
Hi everyone, For one of our projects we have a need to deploy and maintain a demo. As a result I''ve attempted to setup a set of rake tasks for the job. My goal is have one rake task called "deploy_demo" which purges the database, migrates to the current schema, and loads the db from a set of fixture files in a specified location. I''ve written two new tasks the perform
2006 Feb 13
8
postgres and rake
am in a bit of a quandry... I have asked postgresql-users list and haven''t gotten anything to work with... > > How do I change the owner of a schema? > > > > ALTER SCHEMA "public" OWNER to "some_user"; #? > > http://www.postgresql.org/docs/current/interactive/sql-alterschema.html > > The docs explain this very situation. HTML
2005 Mar 10
8
Login controller additions
I have added roles and roles_users table and updated the model so that my users can have multiple roles. ("Admin" role does always have id = 1). I have added these methods to my application controller. <code> helper_method :is_admin? helper_method :is_user? def is_admin? if @session[''user''] @session[''user''].roles.find(1)
2005 Dec 14
3
why would an int column in a join table be a String class in model?
i''ve got an issue with integer columns in the database becoming strings in the model and I''m not sure why this is happening. perhaps someone can explain. given the following setup (simplified for example) tables: users ---------- id - int name - varchar(60) roles ---------- id - int name - varchar(60) roles_users (join table) ---------- role_id - int user_id - int
2005 Oct 11
4
Searching an attribute in a hmabtm relationship
(Nuby to Ruby and Rails...) I''ve implemented security using the login generator in a simple app so that I have a user table, a roles table, and a join between them (roles_users). All works as expected. I now need to check if a user has a specific role, but my approach is off somehow. Here''s what I''ve tried thusfar: user_roles = @session[:user].roles
2006 Aug 16
1
Naming rights_roles join model using has_many :through and polymorphic associations
Hi. I have a couple of best practices questions regarding polymorphic associations, naming join tables and user permissions. Currently I have implemented the user authentication model from the rails recipes book. Basically it goes something like this: MODEL CLASSES: class User < ActiveRecord::Base has_and_belongs_to_many :roles end class Role < ActiveRecord::Base
2006 Jan 26
0
selecting from dynamic pop-up list populated by a table
I''ll try again... I am looking at this page...HowToUseFormOptionHelpers http://wiki.rubyonrails.org/rails/pages/HowtoUseFormOptionHelpers perhaps I should be using Ajax for this...I haven''t looked at Ajax yet. Have 2 tables - clients & case_managers I want the data from a column in case_managers to be the select list on a screen for adding/editing clients as I am pretty
2007 Dec 09
4
Help on drying code
Hi all, Currently I''m having to do this: def self.authorized_roles(controller, action) specific = self.find_by_controller_and_action(controller, action) all_actions = self.find_by_controller_and_action(controller, ''*'') all_controllers = self.find_by_controller(''*'') role_ids = [] specific.each do |role_item| role_ids <<
2006 Apr 02
5
foreign keys and migrations
Hi: I''m looking to get a point clarified which i''m sure is obvious to everyone else but I haven''t been able to find the answer to. i''ve tried searching through the forums and the api pages and haven''t found anything. Is there a way with migrations to set up foregin key relationships? (beyond putting in the relevant foregin_id attributes) Is