Hmmm, it looks like you're doing it correctly. Could you try using the current github master rather than the latest gem? Just add :git => "git://github.com/tablatom/hobo.git" to the hobo gems in your bundle, and remove the version option.
thanks, Bryan On Wed, Jun 13, 2012 at 3:12 PM, Chris Sleys <[email protected]> wrote: > Hey I am on version 1.4.0 pre release and am getting a similar error. I > tryed adding the :accessible => true as well as experimented with the > :creator and :foreign_key tags with no luck. Maybe I'm missing something > obvious but here is the relevant code and error message. > > Thanks in advance for any help or suggestions you can offer, > Chris Sleys > > `block in owner_routes': Hob routing error -- can't find reverse > association for Hour#owner (e.g. the :has_many that corresponds to a > :belongs_to) (Hobo::Error) > > class Hour < ActiveRecord::Base > > hobo_model # Don't put anything above this > > fields do > hours_worked :decimal > date :date > comments :text > timestamps > end > > belongs_to :project, :inverse_of => :hours > belongs_to :work_code, :inverse_of => :hours > belongs_to :owner, :class_name => "User", :creator => true, :inverse_of => > :hours, :accessible => true, :dependent => :destroy > > # --- Permissions --- # > > def create_permitted? > acting_user.signed_up? > end > > def update_permitted? > acting_user.administrator? > owner_is? acting_user > end > > def destroy_permitted? > acting_user.administrator? > owner_is? acting_user > end > > def view_permitted?(field) > owner_is? acting_user > end > > end > > > class User < ActiveRecord::Base > > hobo_user_model # Don't put anything above this > > fields do > name :string, :required, :unique > email_address :email_address, :login => true > administrator :boolean, :default => false > timestamps > end > > # This gives admin rights and an :active state to the first sign-up. > # Just remove it if you don't want that > before_create do |user| > if !Rails.env.test? && user.class.count == 0 > user.administrator = true > user.state = "active" > end > end > > def new_password_required_with_invite_only? > new_password_required_without_invite_only? || self.class.count==0 > end > alias_method_chain :new_password_required?, :invite_only > > # --- Signup lifecycle --- # > > lifecycle do > > state :invited, :default => true > state :active > > create :invite, > :available_to => "acting_user if acting_user.administrator?", > :subsite => "admin", > :params => [:name, :email_address], > :new_key => true, > :become => :invited do > UserMailer.invite(self, lifecycle.key).deliver > end > > transition :accept_invitation, { :invited => :active }, :available_to => > :key_holder, > :params => [ :password, :password_confirmation ] > > transition :request_password_reset, { :active => :active }, :new_key => > true do > UserMailer.forgot_password(self, lifecycle.key).deliver > end > > transition :reset_password, { :active => :active }, :available_to => > :key_holder, > :params => [ :password, :password_confirmation ] > > end > > def signed_up? > state=="active" > end > > has_many :hours, :inverse_of => :owner, :accessible => true > children :hours > > # --- Permissions --- # > > def create_permitted? > # Only the initial admin user can be created > self.class.count == 0 > end > > def update_permitted? > acting_user.administrator? || > (acting_user == self && only_changed?(:email_address, > :crypted_password, > :current_password, :password, > :password_confirmation)) > # Note: crypted_password has attr_protected so although it is permitted > to change, it cannot be changed > # directly from a form submission. > end > > def destroy_permitted? > acting_user.administrator? > end > > def view_permitted?(field) > true > end > end > > > > Thanks, > Chris Sleys > > On Thursday, January 21, 2010 5:01:11 PM UTC-5, Me wrote: >> >> >> Greetings. I built an app sometime back with Hobo 0.8.3 and rails >> 2.1.1 on Ubuntu Hardy. That machine is now defunct. I'm trying to re- >> deploy it with 0.9.103 on an Ubuntu Jaunty machine with rails 2.3.5. >> I've overcome a few gotchas, but this one has me stumped: >> >> model_router.rb:176:in `owner_routes': Hob routing error -- can't find >> reverse association for Archive#workspace (e.g. the :has_many that >> corresponds to a :belongs_to) (HoboError) >> >> From searching the archives, the solution each time was to correct >> errors in the association itself. In my case, I can't find what I did >> wrong. At the same time, it used to work. This is the association >> that used to be valid: >> >> archive.rb >> belongs_to :workspace >> >> workspace.rb >> has_many :archives, :foreign_key => >> "workspace_id" >> >> In archive_controller.rb : >> auto_actions :all, :except => :index >> auto_actions_for :workspace, [:new] >> >> I tried adding the FK to the archive.rb belongs_to half, but it didn't >> help. I also tried downgrading to rails 2.2.2, but got the same error. >> Does anyone know what I did wrong? >> >> Thanks! > > > On Thursday, January 21, 2010 5:01:11 PM UTC-5, Me wrote: >> >> >> Greetings. I built an app sometime back with Hobo 0.8.3 and rails >> 2.1.1 on Ubuntu Hardy. That machine is now defunct. I'm trying to re- >> deploy it with 0.9.103 on an Ubuntu Jaunty machine with rails 2.3.5. >> I've overcome a few gotchas, but this one has me stumped: >> >> model_router.rb:176:in `owner_routes': Hob routing error -- can't find >> reverse association for Archive#workspace (e.g. the :has_many that >> corresponds to a :belongs_to) (HoboError) >> >> From searching the archives, the solution each time was to correct >> errors in the association itself. In my case, I can't find what I did >> wrong. At the same time, it used to work. This is the association >> that used to be valid: >> >> archive.rb >> belongs_to :workspace >> >> workspace.rb >> has_many :archives, :foreign_key => >> "workspace_id" >> >> In archive_controller.rb : >> auto_actions :all, :except => :index >> auto_actions_for :workspace, [:new] >> >> I tried adding the FK to the archive.rb belongs_to half, but it didn't >> help. I also tried downgrading to rails 2.2.2, but got the same error. >> Does anyone know what I did wrong? >> >> Thanks! > > -- > You received this message because you are subscribed to the Google Groups > "Hobo Users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/hobousers/-/S9iyXiuqKnUJ. > 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. -- 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.
