I tried to reproduce in a test app, with AS 3.3.3 and 3.4.9 and I didn't get 
that behaviour. I 
tested with a controller without namespace, with Admin namespace and 
Admin::Scaffold 
namespace, same order in routes. I didn't have any 
active_scaffold_controller_for method, 
but you get the error without that method too.

What confused me was return "Spree::#{klass}Controller".constantize while 
routes goes 
to /orders, without spree namespace. Anyway it's weird to generate the route to 
/orders/populate with controller=admin_scaffold/orders param (usually there is 
no 
controller param, controller would be orders). I don't know if you can have 
some other 
overrided method.

Also you can try to add some debugging to active_scaffold_controller_for method:

def self.active_scaffold_controller_for(klass)
  return ("Spree::#{klass}Controller".constantize rescue super).tap do |c|
    Rails.logger.debug "active_scaffold_controller_for: #{c.name}"
  end
end

El Lunes, 8 de diciembre de 2014 11:49:20 Jason Fleetwood-Boldt escribió:
> Sergio,
> 
> Thanks so much for your assistance. (Would be great to get this working).
> Sorry for the delay.
> 
> It's confusing because when I copy & pasted from my text editor the colors
> came out in the email, so there's code that is white (color) in the past
> that looks like it isn't there.
> 
> here's my base controller....
> https://gist.github.com/jasonfb/5bdb6a04371b854dd1e6
> 
> 
> My AS route operates at /admin/scaffold/orders
> 
> If I disable the code in the base class (above), I still have the same
> problem (all routes go to /orders/populate when they should be going to
> /admin/scaffold/orders)
> 
> 
> I have 3 controllers named "OrdersController":
> 
> 1)
> /app/controllers/orders_controller.rb -> looks like:
> https://gist.github.com/jasonfb/1441eba4d6a0d3f0646f (the base class looks
> like https://gist.github.com/jasonfb/b50bc1fc681b36241458)
> 
> route associated with this is:
>                                                orders GET   
> /orders(.:format)                                                          
>   spree/orders#index
> 
> 
> 
> 2) A admin order controller (provided by Spree)
> 
> /app/controllers/admin/orders_controller.rb -> looks like
> https://gist.github.com/jasonfb/d8d1cd7c41476ee0d9a7 (the base class looks
> like https://gist.github.com/jasonfb/3b90b091829ba0f0fcc1)
> 
> the route associated with this is at:
>                                          admin_orders GET   
> /admin/orders(.:format)                                                    
>   spree/admin/orders#index
> 
> 
> 
> 3) The AS OrdersController, described in previous email.
> 
> /app/controllers/admin/scaffold/orders_controller.rb -> Looks like
> https://gist.github.com/jasonfb/dac9bb1d77406cf650ec
> 
> the route associated with this is:
> 
>                 admin_scaffold_orders GET     
> /admin/scaffold/orders(.:format)                     
> admin/scaffold/orders#index
> 
> 
> In my routes file, #3 appears first, then #1, then #2
> 
> Thanks,
> Jason
> 
> > On Dec 5, 2014, at 2:22 PM, Sergio Cambra <[email protected]> wrote:
> > 
> > El 30-11-2014 18:46, Jason Fleetwood-Boldt escribió:
> >> I’m having a strange issue where all the links on my page are going to a
> >> strange route (specifically, a route that exists in my app but is not
> >> associated with AS in any way, see below)
> >> 
> >> 
> >> My page loads correctly at:
> >> 
> >> http://127.0.0.1:3000/admin/scaffold/orders
> >> <http://127.0.0.1:3000/admin/scaffold/orders>
> >> 
> >> Every link (Edit, Search, all the pagination links) go to something like:
> >> 
> >> http://127.0.0.1:3000/orders/populate?action=edit&controller=admin_scaffo
> >> ld%2Forders&id=R345160226
> >> <http://127.0.0.1:3000/orders/populate?action=edit&controller=admin_scaf
> >> fold%2Forders&id=R345160226>
> >> 
> >> /orders/populate is a route in my app, but it has nothing to do with
> >> Active Scaffold. As far as I can see, the links should be simply to
> >> /admin/scaffold/orders, but for some reason they are coming out to
> >> /orders/populate.
> >> 
> >> Any clues as to what is happening here?
> >> 
> >> Here’s the base class to that object:
> >> 
> >> class Admin::Scaffold::BaseController < Spree::BaseController
> >> 
> >>   layout 'admin/scaffold/layouts/admin_application.html.erb'
> >>   protected
> >> 
> >> def self.active_scaffold_controller_for(klass)
> >> return "Spree::#{klass}Controller".constantize rescue super
> >> 
> >>   end
> >> 
> >> end
> > 
> > This line is confusing me, what controllers for Order do you have? default
> > active_scaffold_controller_for try first for controller in current
> > namespace (Admin::Scaffold::OrdersController) and then with no namespace
> > (OrdersController). However it's weird generate a route with a controller
> > param. Can you post your OrdersController, in every namespace, and their
> > routes, in same order as your config/routes.rb file?
> ----
> 
> Jason Fleetwood-Boldt

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails Gem" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/activescaffold.
For more options, visit https://groups.google.com/d/optout.

Reply via email to