On Dec 8, 2009, at 6:17 PM, Brian Corbin wrote:

>
> I take it back, that was the issue.  After I added in the missing
> has_many associations, hobo:generate_taglibs completed succesfully.
> Sorry, somehow I knew this would turn out to be all my fault.  Anyway,
> I know have another issue.  My user model
> belongs_to :default_location, class_name => "Location".  The
> children :users declaration doesn't pick up on that and results in
> this:
> SQLite3::SQLException: no such column: users.location_id: SELECT count
> (*) AS count_all FROM "users" WHERE ("users".location_id = 1)
>
> Is there a way to tell the children directive what the database field
> is?  Thanks-
>
> Brian

Yep - you need to declare the reverse reflection (here, the  
has_many :users on Location) correctly. Note that actually calling  
@location.users in the models as shown in your first post would net  
you the same error - the correct declaration (on Location) is:

has_many :users, :foreign_key => 'default_location_id'

It's an extra wrinkle that you only run into when giving a belongs_to  
a non-default name.

--Matt Jones

--

You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.


Reply via email to