[Rails] Re: is overriding file naming conventions (for models and controllers) possible?
On Apr 3, 2:57 pm, Alexey Muranov <li...@ruby-forum.com> wrote:
> 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".
>
> I suspect that the answer is "No".
For what it's worth you can declare any class in any file - however if
you don't put classes where rails expects to find them then it won't
be able to magically load them for you
> Should the route be
> match "see" => "known_i_ps#show"
> or
> match "see" => "known_ips#show"
> in this case?
The routing bit and the class loading bit aren't really related (in
that it doesn't matter what routes exist, when automatically requiring
a file for you rails wants known_ips_controller.rb to define
KnownIpsController)
Fred
>
> None works, the errors are, respectively,
> uninitialized constant KnownIPsController
> and
> Expected .../test_app/app/controllers/known_ips_controller.rb to
> define KnownIpsController
>
> Alexey.
>
> --
> Posted viahttp://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 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