I'm revamping an app that I wrote back in 2007 with Hobo 0.6.2. The
books have been a HUGE help in that respect so thanks to all who
contributed.
I'm trying to get ownership working in my app so that I can make use
of owner_changed? and owner_is? for permissions. I'm doing something
very similar to what's in the Agility tutorial. In my app a user has
many trackings a tracking belongs to a user. So here's what I have:
In user.rb -- has_many :trackings, :class_name =>
"Tracking", :foreign_key => "owner_id"
in tracking.rb -- belongs_to :owner, :class_name => "User", :creator
=> true
The trouble kicks in when I try to show a user's trackings. In my
user controller I have this:
def show_trackings
@this = Tracking.paginate(:page => params[:page],
:conditions => [ "user_id = ?",
params[:id].to_i ],
:order => "term ASC",
:include => [:interest, :user])
end
When I run it I get this error: "Association named 'user' was not
found; perhaps you misspelled it?
". If I remove user from the "include" the page loads fine. But if I
continue on from the show trackings page and try to add a new tracking
I then get an error that says "unknown attribute: owner_id" when I try
to save a newly created tracking. I guess I'm missing something.
While I'm asking this I have another question about how I'm doing the
show_trackings method. When I had this app working in the old Hobo
instead of doing a paginate I just used this -
hobo_show_collection :trackings, :order => "term ASC", :include =>
[:interest, :user] -- Is there something similar in the current Hobo?
Should I be using hobo_index_for ?
Thanks for any help.
--
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.