Hi Lea, Good news, I have reproduced your issue :). I have set up an app with the same models and controllers, and when navigating to "/admin/registrations/1", I see in the log similar errors:
polymorphic_url has failed with NoMethodError: undefined method `account_admin_user_path' for #<#<Class:0x00000004a0bb18>:0x00000001cd65f8> polymorphic_url has failed with NoMethodError: undefined method `admin_accommodation_path' for #<#<Class:0x00000004a0bb18>:0x00000001cd65f8> And if you look into the screenshot, you can see that the account link could not be found inside the admin controller, and the same thing with the accommodation link. These are the corresponding warnings in the log: I added these "warnings" in this commit: https://github.com/Hobo/hobo/commit/be9fb7d7e9113e3c5a354104fbbef4a3a3e1e26d. My intention was to help users debug when a form was not rendered and failed silently. Maybe the messages should be written in a more descriptive way. Any suggestion? Workaround for now: find the links that Hobo is not capable of routing to and replace them manually in Dryml with the correct route. Please ask if you need help with this. Solution for the future: make Hobo smarter when using subsites, so it's really capable of finding the correct route. I'll open a Github issue. Warm regards, Ignacio El 05/05/14 22:10, Lea Viljanen escribió: > I have some old Hobo/Rails 3 code I successfully ported to new Hobo/Rails 4. > Except for some polymorphic route issues, which are kind of a new > thing for Rails 4. > > I have this piece of code: > > class Registration > belongs_to :accommodation, :accessible => true > > class Accommodation > fields do > price :integer > end > > And now I have a controller where I have a method: > > def list_indoors > .... > @registrations = Registration.joins(:accommodation).where('price > 0' > ).load > > hobo_show @registrations, :order => "created_at DESC" > > end > > Which, when run, gives me an error: > > polymorphic_url has failed with NoMethodError: undefined method > `accommodation_path' for #<#<Class:0xb438c390>:0xb4397ba0> > > I have some other code like this as well, and the issue plagues all my > methods, where I'm going through a joins directive in selecting the > displayed data. If I have a simple .where filter, no problems > whatsoever. This may or may not be related. > > Second thing to note, the controller for the affected model is in an > admin subsite, because that's where I create and edit the model data > and thus the > resource :accommodation > is also in the subsite section of hobo_routes.rb > > There is no resource directive in the main website routes for the > Accommodation model because I don't need accommodation data to be HTTP > accessible from main web site. If I add the resource :accommodation to > routes.rb for the main website section, I get rid of the undefined > method error but I start getting errors about the "missing" > AccommodationsController. But I don't need that. > > The code actually works, with errors and all, but I want to know > what's wrong and how I get rid of the error. > > Do I need to do something specific with Hobo routes when upgrading? > -- You received this message because you are subscribed to the Google Groups "Hobo Users" 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/hobousers. For more options, visit https://groups.google.com/d/optout.
