Alan Sikora wrote:
> Email:
...
> Password:
...
> Role:
Would probably be better as:
Email:
...
Password:
...
Role:
Long live CSS!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Tal
As @Fredrick said, you can do something like
in user.rb
has_many :roles (or has_one :role)
and in role.rb
belongs_to :user
so in your controller you'd call user.role.name (or
user.roles.first.name if you have many roles and want to get the
first).
On Oct 9, 10:56 pm, Alan Sikora <[EMAIL PROTECTE
As @Fredrick said, you can do something like
in user.rb
has_many :roles (or has_one :role)
and in role.rb
belongs_to :user
so in your controller you'd call user.role.name (or user.roles.first.name if
you have many roles and want to get the first).
>From what you have I worry if Role.find returns
On Oct 10, 3:56 am, Alan Sikora <[EMAIL PROTECTED]> wrote:
>
> Role:
> <%=h Role.find(@user.role_id).name %> ==> This
> line, is it right? Is there a better way to do it?
>
typically you would have an association between users and roles so
that you could do user.role
4 matches
Mail list logo