Hi !
i've different users subclasses organised thanks to STI under a user
mother class, problem is that i can't find a way to exchange a user form
a certain type to an other , any light ???
class User < ActiveRecord::Base
end
class Guest < User
has_and_belongs_to_many :hosts,
:join_table => 'invitations'
end
class Host < User
has_and_belongs_to_many :guests,
:join_table => 'invitations'
end
#i'd like to change a Guest user to make him become Host :
>> g = Guest.first
=> #<Guest id: 418519017, type: "Guest", ...#>
g.update_attributes!(:type=>'Host')
=> true
>> g
=> #<Guest id: 418519017, type: "Guest", ...#>
#It seems that this "type" attribute is protected is there a way to
by-pass this ?
you can find the pastie of the above code here :
http://pastie.org/317885
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" 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/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---