Yes, I'm quite new to rails, so I tried this from teh Recipe book. ;) To answer the questions: 1. I got the tables 2. HEUREKA! It works when I type Role.find(:first).rights << Right.find(:first) at the console. But I think it is very strange.
Thanks for your tip. Maybe someones got an explanation for this? j On 25 Apr., 17:43, Kevin Triplett <[EMAIL PROTECTED]> wrote: > LOVE these kind of error messages, "Right expected, got > Right," priceless. :b Makes me think there is a conflict > going on behind the scenes. > > But it looks like you're doing it right and by the book > (literally, as detailed in the Rails Recipe book, and one > that I implemented awhile back and then dropped in favor of > the acl_system2 plugin, which is a little simpler and more > rigid but not as dynamic as this one.) > > This may not be helpful question, but do you have the > rights_roles table in your database? Also roles_users? It > seems there is something behind the scenes. Does it still > give you the error if you do soemthing like > > Role.find(:first).rights << Right.find(:first) > > Kevin > > phaenotyp wrote: > > Thanks for trying to help. > > > I have a HABTM relation between Roles, Users and Rights like this > > > class Right < ActiveRecord::Base > > has_and_belongs_to_many :roles > > end > > > class Role < ActiveRecord::Base > > has_and_belongs_to_many :users > > has_and_belongs_to_many :rights > > end > > > class User < ActiveRecord::Base > > > has_and_belongs_to_many :roles > > > end > > >>> role = Role.find(:first) > > #<Role id: 7, name: "root", created_at: "2008-04-25 02:21:49", > > updated_at: "2008-04-25 02:21:49"> > > >>> right = Right.find(:first) > > #<Right id: 10, name: "Adventurelist", controller: "adventures", > > action: "index", created_at: "2008-04-25 06:05:08", updated_at: > > "2008-04-25 06:05:08"> > > >>> role.rights << right > > ActiveRecord::AssociationTypeMismatch: Right expected, got Right > > > That's where I'm stuck. > > > Kind regards > > > On 25 Apr., 15:47, justindz <[EMAIL PROTECTED]> wrote: > >> I can try to help. You might use something like pastie or just post > >> the related code here, though, as I don't recognize the error but > >> might have some insight if I could see the block or file causing the > >> problem. > > >> On Apr 25, 5:36 am, phaenotyp <[EMAIL PROTECTED]> wrote: > > >>> Hi guys, > >>> heroku is awesome stuff. I'm really impressed with all the features > >>> and possibility, ease of use. > >>> While developing an Rails-application I'm encountering a problem > >>> though. I do not know, if it is specific to heroku, 'cause I'm quite > >>> new to Rails. > >>> While trying to associate entries to oneanother I get this error: > >>> ActiveRecord::AssociationTypeMismatch: Right expected, got Right > >>> any suggestions? > >>> kind regards > >>> p --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Heroku" 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/heroku?hl=en -~----------~----~----~----~------~----~------~--~---
