On Mar 18, 5:32 pm, Frederick Cheung <frederick.che...@gmail.com>
wrote:
> A more railsy way of doing
> it would be for player2 to be an association and to define a full name
> method on Player ie
>
> def full_name
>  firstName + lastName
> end
>
> and then your view would look like <%= h @game.player2.full_name %>
>
> It's also convention that attribute names be underscored (ie
> first_name rather than firstName)

The other convention I think is important here is that your "getters"
do not start with "get" like they do in Java. You generally just put
the attribute name. Because Ruby doesn't require parentheses after
methods, you can just say "player.full_name" instead of
"player.getFullName()" like you would in Java. It's a more concise and
clear grammar.

-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to