I''m grouping controllers to avoid cluttering the top-level namespace. First, I used script/generate Admin::Customers new edit show list and then I used script/generate Admin::Providers new edit show list. The generator created the subfolders correctly: I have an admin folder and inside there''s customer_controller.rb and provider_controller.rb. I have the same structure in views. BUT when I go to http://localhost:3004/admin/customer/list I get an Unknown Action error. I''m positive that the action is declared in the respective controller. Am I missing something? I read about this on the Agile Web Development with Rails book on the Naming conventions section but can''t seem to make it work. Can anyone please advice? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060525/1e49f18d/attachment.html
Hello,
Are you sure you have the following structure?
- app
- controllers
- admin
- customers_controller.rb
- providers_controller.rb
...
- views
- admin
- customers (pay attention: this is a folder)
- list.rhtml
- ...
- providers (this is a folder too)
- list.rhtml
- ...
Marcia
Naju Ventura wrote:> I''m grouping controllers to avoid cluttering the top-level
namespace.
>
> First, I used script/generate Admin::Customers new edit show list and
> then I
> used
> script/generate Admin::Providers new edit show list.
>
> The generator created the subfolders correctly: I have an admin folder
> and
> inside there''s customer_controller.rb and provider_controller.rb.
>
> I have the same structure in views. BUT when I go to
> http://localhost:3004/admin/customer/list I get an Unknown Action error.
> I''m
> positive that the action is declared in the respective controller. Am I
> missing something?
>
> I read about this on the Agile Web Development with Rails book on the
> Naming
> conventions section but can''t seem to make it work. Can anyone
please
> advice?
--
Posted via http://www.ruby-forum.com/.
Yes, I''m sure and yes, those are folders.
I also checked that my controllers start with:
class Admin::CustomerController < ApplicationController
I''ve found this: http://www.ruby-forum.com/topic/65539
it says that I should be using the following code inside
CustomerController.rb
module Admin
class CustomerController < ApplicationController
...
end
end
I tried that and still no results.
I''ve also read that perhaps I could solve this configuring routes.rb
but I
feel that shouldn''t be necessary.
What I find puzzling is that I''m not getting a "Routing
error" but a "Unknown
action" which I think it means that the route it''s trying to solve
is
correct. I think I''m mising something.
On 5/25/06, Marcia Almeida <marciaalmeida@caracol.inf.br>
wrote:>
> Hello,
>
> Are you sure you have the following structure?
> - app
> - controllers
> - admin
> - customers_controller.rb
> - providers_controller.rb
> ...
> - views
> - admin
> - customers (pay attention: this is a folder)
> - list.rhtml
> - ...
> - providers (this is a folder too)
> - list.rhtml
> - ...
>
> Marcia
>
>
>
> Naju Ventura wrote:
> > I''m grouping controllers to avoid cluttering the top-level
namespace.
> >
> > First, I used script/generate Admin::Customers new edit show list and
> > then I
> > used
> > script/generate Admin::Providers new edit show list.
> >
> > The generator created the subfolders correctly: I have an admin folder
> > and
> > inside there''s customer_controller.rb and
provider_controller.rb.
> >
> > I have the same structure in views. BUT when I go to
> > http://localhost:3004/admin/customer/list I get an Unknown Action
error.
> > I''m
> > positive that the action is declared in the respective controller. Am
I
> > missing something?
> >
> > I read about this on the Agile Web Development with Rails book on the
> > Naming
> > conventions section but can''t seem to make it work. Can
anyone please
> > advice?
>
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060526/1606d5d0/attachment-0001.html
Do you have admin_controller.rb file in app/controllers folder? If yes, remove it or rename it (i.e. admin_base_controller.rb) if you need it i.e. for inheritance and it should work. -- Posted via http://www.ruby-forum.com/.
indeed that''s the solution. I thought I needed to have admin_controller.rb so the others could "inherit" from it. :( Can''t believe it was so simple! Thanks a lot szymek! On 5/26/06, szymek <g0nzo@o2.pl> wrote:> > Do you have admin_controller.rb file in app/controllers folder? If yes, > remove it or rename it (i.e. admin_base_controller.rb) if you need it > i.e. for inheritance and it should work. > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060526/70e9570a/attachment.html
Now I have a follow up question: In the layouts, I had to create an admin folder and inside I created 2 layouts, customers.rhtml and providers.rhtml. Is there a way to have ONLY one layout for customers_controller.rb and providers_controller.rb ??? Naju Ventura wrote:> I''m grouping controllers to avoid cluttering the top-level namespace. > > First, I used script/generate Admin::Customers new edit show list and > then I > used > script/generate Admin::Providers new edit show list. > > The generator created the subfolders correctly: I have an admin folder > and > inside there''s customer_controller.rb and provider_controller.rb. > > I have the same structure in views. BUT when I go to > http://localhost:3004/admin/customer/list I get an Unknown Action error. > I''m > positive that the action is declared in the respective controller. Am I > missing something? > > I read about this on the Agile Web Development with Rails book on the > Naming > conventions section but can''t seem to make it work. Can anyone please > advice?-- Posted via http://www.ruby-forum.com/.
Naju Ventura wrote:> Now I have a follow up question: > > In the layouts, I had to create an admin folder and inside I created 2 > layouts, customers.rhtml and providers.rhtml. Is there a way to have > ONLY one layout for customers_controller.rb and providers_controller.rb > ??? >in your controller layout "layouts/customers" something like that?? http://api.rubyonrails.org/classes/ActionController/Layout/ClassMethods.html -- Posted via http://www.ruby-forum.com/.