Displaying 20 results from an estimated 500 matches similar to: "Naming rights_roles join model using has_many :through and polymorphic associations"
2006 Nov 04
0
RESTful controller naming conventions
It is my understanding that originally controller names where singular.
In all the examples of RESTful controllers the names have been
pluralized.
So what is the new convention? Singular or plural controller names?
Leevi Graham
Front End Developer - User Interface Designer
www.leevigraham.com | Skype Me: leevi_graham
MSN Messenger: info@leevigraham.com
Download My VCard
--------------
2006 Dec 08
19
HABTM join table quirk
I''ve been bringing up a good basica framework for applications at work.
To give decent security I''ve been implementing the Rails Recipie for
Authorization of function calls modeled on the book''s implementation.
(Changes for our environment were added..but are minor.)
Since I initially let Rails create the join table between two data
tables with a HABTM relationship....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 Apr 07
0
HABTM query return all results
I have a role-based authorization system exactly like the one from Rails
Recepies. I am looking to return all rights however in my view I want to
highlight the rights that are associated with the currently selected
role (passed in through @params[:id]).
Schema:
create_table "rights", :force => true do |t|
t.column "name", :string
t.column "controller",
2006 Jul 26
3
Polymorphic Association with Single Table Inheritance?
Hello,
is it possible to setup a model/table schema like this:
Groupable --> Membership <-- Group
^ ^
| |
User UserGroup
I tried the following but failed:
Groupable (table with ''type'' column)
has_many :memberships, :as => :groupable
has_many :groups, :through => :memberships
2006 Apr 15
8
Migrations - adding a new table and automatically creating records
I want to create table called roles and then populate it with some new
records...This doesn''t work. Is there something I''m missing?
Craig
class AddRightsAndRolesTables < ActiveRecord::Migration
def self.up
create_table :roles do |t|
t.column "name", :string
end
Role.reset_column_information
Role.new :name => "Users Admin"
2006 Apr 15
6
view code regular expression
I''m lost on regular expressions to begin with...
I''m trying to fix a value to one of 4 radio buttons as there will be
value of either 1,2,3 or 4 in @roles_users...
<TD><input type="radio" id="roles"
name="case_managers[case_manager_name]"
value="Case Manager Admin"
<% if =~ @roles_users /1/ checked =
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...
2016 Jul 28
3
Why is Samba4 not recommended as a file server?
On 28/07/16 07:43, Michael Adam wrote:
> Exactly. And it is a recommendation for a better layout, not a strict
> requirement. Reasons being that it is genrally better to separate
> responsibilites, and that in this case, you have more control over the
> fine-tunings of a file server if it is not at the same time an AD/DC.
> Cheers - Michael
>
This is all very well and good
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 =
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
2016 Jul 28
2
Why is Samba4 not recommended as a file server?
Mark Foley <mfoley at ohprs.org> writes:
> Since you bring up that topic (Samba4 not recommended as a file server), I've been meaning to
> ask on this list for a while: Why?
> [...]
>> As for the info you would like adding to the wiki, it used to be there,
>> but when the wiki was re-written, it was removed. The thinking seemed to
>> be, as samba doesn't
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
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)
2006 May 24
0
polymorphic url and polymorphic partial helpers
Here are a couple of articles I wrote describing a couple of handy
helpers for dealing with polymorphic objects.
These helpers allow you to generate urls and render partials on objects
without knowing what class they are ahead of time.
http://www.sciwerks.com/blog/2006/05/24/polymorphic-urls/
http://www.sciwerks.com/blog/2006/05/24/polymorphic-partials/
Hopefully you will find them useful.
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
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
2006 Aug 06
0
Polymorphic Destroy
Is there a clever way to destroy just the link in Polymorphic
association? For instance, in the example they have folders containing
images. If I want to destroy the link from the folder to the image (not
the image and not the folder), do I have to search through the join
models to find the correct join model that links the folder and the
image, or is there a more clever way? That''s
2006 Aug 10
0
polymorphic challenge
Hello guys,
I have 2 classes (I pasted small part of them here);
class Shop < ActiveRecord::Base
has_many :items, :as=> :itemable
protected
def self.paying_scope
with_scope(:find => {:conditions => ''expires_on > NOW()'', :include
=> [:address]}) do
yield
end
end
end
class Item < ActiveRecord::Base
belongs_to :itemable,
2006 Aug 11
1
Polymorphic Not Updating after deleting join
Using the example in the docs if I say
@folder.items
and I list the items, everything lists fine. If I delete a ''linking'', I
still get the same list. Shouldn''t I get one less item even though the
other two db''s haven''t been updated?
--
Posted via http://www.ruby-forum.com/.