ok, my guess is the use of creator as an association name is throwing hobo off. it probably defines a method creator for the :creator => true flag that links to the right association. That would be my guess at least.
On Dec 9, 7:43 am, Mark Sobkowicz <[email protected]> wrote: > On Dec 8, 2010, at 2:33 PM, kevinpfromnm wrote: > > > actually, that index loop tells me something in the user or maybe tag > > model is confusing the hell out of hobo fields indexing. can you post > > both? > > In my last email, I was missing the foreign_key assignments for the has_many > associations. I added them in, but still get the same indexing problems > with the migration generator. One thing I noticed in schema.rb I have > > add_index "recipes", ["creator_id"], :name => "index_recipes_on_creator_id" > add_index "recipes", ["creator_id"], :name => "index_recipes_on_user_id" > > and > > add_index "tags", ["owner_id"], :name => "index_tags_on_creator_id" > add_index "tags", ["owner_id"], :name => "index_tags_on_owner_id" > add_index "tags", ["owner_id"], :name => "index_tags_on_user_id" > > Which seems to have lines left over from previous versions. Is the > hobo_migration generator not deleting lines properly from this? Is it safe > to just delete the erroneous lines from schema.rb? Or can I delete the whole > file and have it regenerated? I've always assumed that I should leave > schema.rb alone. > > --------------------------------------------------------------- > user.rb: > > 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 > receive_weekly :boolean, :default => false > receive_every_recipe :boolean, :default => false > receive_my_requests :boolean, :default => false > timestamps > end > > has_many :recipes, :foreign_key => "creator_id" > has_many :recipe_requests > has_many :tags, :foreign_key => "owner_id" > > .....everything else is unchanged from the --invite-only template. > ------------------------------------------------------------- > tag.rb > > class Tag < ActiveRecord::Base > > hobo_model # Don't put anything above this > > fields do > title :string > timestamps > end > validates_presence_of :title > validates_uniqueness_of :title, :scope => :owner_id > validates_length_of :title, :maximum => 12 > > belongs_to :owner, :class_name => "User", :creator => true > has_many :recipes, :through => :tag_assignments, :accessible => true > has_many :tag_assignments, :dependent => :destroy > > # --- Permissions --- # > > def create_permitted? > acting_user.signed_up? || acting_user.administrator? > end > > def update_permitted? > acting_user== owner > end > > def destroy_permitted? > acting_user== owner > end > > def view_permitted?(field) > owner_is? acting_user or new_record? > end > > end -- 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.
