Sunday, April 3, 2011

Re: [Rails] is overriding file naming conventions (for models and controllers) possible?

On 3 April 2011 13:25, Michael Pavling <pavling@gmail.com> wrote:
> On 2 April 2011 23:50, Alexey Muranov <lists@ruby-forum.com> wrote:
>> Hello, i have another question about overriding Rails conventions.
>>
>> Is it possible to tell Rails which model/controller is defined in which
>> file?
>>
>> I have generated a model and a controller as follows:
>>
>> $ rails generate model KnownIP ...
>> ...
>> $ rails generate controller KnownIPs ...
>>
>> The problem is with the "IP" in the name: now i have a model *KnownIp*
>> in the file *known_ip.rb* and a controller *KnownIPsController* in the
>> file *known_i_ps_controller.rb*, which does not look consistent.
>
> Something's wrong with your typing here or on the console, because
> your model should be "KnownIP" if you typed "$ rails generate model
> KnownIP". If the "p" is lower case in the model, you must have typed a
> lower case p...

Actually Alexey is right, using rails 3.0.5 then
rails g model KnownIP
generates models/known_ip and class KnownIp

Also
rails g model ABCdEF
gives ab_cd_ef.rb and class AbCdEf
and
rails g model ABCDEFG
gives abcdefg.rb and class Abcdefg

all rather odd.

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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate