On 3 April 2011 14:13, Alexey Muranov <lists@ruby-forum.com> wrote:
> ...
> I want to have a model KnownIP and a controller KnownIPs controller, and
> i want to choose myself how to name their files ("known_ip.rb" and
> "known_ips_controller.rb", for example).
I have posted a question on the rails core list asking whether there
is a bug in tableize or whether this is as expected.
http://groups.google.com/group/rubyonrails-core/browse_thread/thread/c3b4ec662226e2a7?hl=en
> I also want to understand the rules and options about naming those
> files, in order not to run into some model name or controller name which
> would be *impossible* to store in *any* file :).
You are entirely free to choose controller names and associated routes
as you wish, neither has anything to do with model names. There is
often a 1:1 relationship between models and controllers. You can
therefore allow rails to call the model KnownIp but have the
*controller* and routes as known_ips. Just make sure that in the
controller you reference the model by its actual name (KnownIp).
In addition it is possible to override the table name for a model
using set_table_name in the model. Whether it is valid to have a
model KnownIP in a file known_ip.rb I do not know. Forget about the
model generator and try it and see. Don't forget to remove any old
files of similar names from the models directory.
Colin
--
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 rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment