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 PROTECTED]> wrote: > Hello, I'm totally new to RoR but I work with PHP and Java for a > while (7 years)... I'm getting used to Ruby and I'd like to know if > the code below is "right". It is the "show" page of the Users table... > > <p> > <b>Email:</b> > <%=h @user.email %> > </p> > > <p> > <b>Password:</b> > <%=h @user.password %> > </p> > > <p> > <b>Role:</b> > <%=h Role.find(@user.role_id).name %> ==========> This > line, is itright? Is there a betterwayto do it? > </p> > > <%= link_to 'Edit', edit_user_path(@user) %> | > <%= link_to 'Back', users_path %> > > Thank you! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---