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.

Reply via email to