On 3 April 2011 14:57, Alexey Muranov <[email protected]> wrote: > Colin Law wrote in post #990676: >> 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 >> > > Thanks! > >> 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. > > I know this, my question is specifically about naming files where the > classes are defined. > In particular, if it is possible to define > > class KnownIPsController < ApplicationController > end > > in a file named "known_ips_controller.rb". ruby-1.8.7-p302 > "KnownIPsController".underscore => "known_i_ps_controller" so put it in a file called known_i_ps_controller.rb, and since ruby-1.8.7-p302 > "KnownIPsController".underscore.camelize => "KnownIPsController" then you should be ok, or at least you should get a bit further.
Colin > > I suspect that the answer is "No". > Should the route be > match "see" => "known_i_ps#show" > or > match "see" => "known_ips#show" > in this case? > > None works, the errors are, respectively, > uninitialized constant KnownIPsController > and > Expected .../test_app/app/controllers/known_ips_controller.rb to > define KnownIpsController > > Alexey. > > -- > Posted via http://www.ruby-forum.com/. > > -- > 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 [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-talk?hl=en. > > -- 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 [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-talk?hl=en.

