On Jul 19, 12:32 am, "Jack Danger Canty" <[EMAIL PROTECTED]>
wrote:
> > In the spirit of common naming conventions, I reckon the value_method
> > and text_method parameters should default to :id and :name
> > respectively. What are everyone's views on this?
>
> While those are very reasonable defaults it seems like the error message
> would have to be quite elaborate in case the model doesn't have a :name
> attribute. I think it would be quite difficult for a newbie to write:
> <%= collection_select :user, :login, @users %>
> and try to debug:
> NoMethodError: undefined method `name' for #<User:0x340948c>
>
> Given that 'name' doesn't appear in their code the average developer would
> be confused.
>
> ::Jack Danger
That's a good point, but I remember as a developer starting with rails
I found this was true of a lot of things. Often the solution was just
that I was not following standardized naming (<singular>_id foreign
key for model associations, for example). Because of this, though, I
started to follow standard naming and embrace the importance of it and
became a more effective developer because of it.
This is of course a very minimal thing that I considered while working
with it today and was just interested as to what everyone thought of
it and how deep these conventions should go.
Regards,
Edd Morgan
http://www.eddm.co.uk
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---