HABTM fixtures issue

Hi all , (environment : Rails 2.1, Authorization Plugin)

I am setting up fixtures (w autogenerated IDs) , but I am stuck with the following issue w the roles_users table

I have a users.yaml fixtures file w following info

DEFAULTS: &DEFAULTS     created_at: <%= 15.days.ago.to_s(:db) %>     updated_at: <%= 15.days.ago.to_s(:db) %>     activated_at: <%= 15.days.ago.to_s :db %> mickey:   first_name: mickey   last_name: rourcke   email: mickey@example.com   franchise: two   state: active   <<: *DEFAULTS .....

I can define the HABTM relation directly into the 'roles.yaml' fixtures file as follows :

DEFAULTS: &DEFAULTS    created_at: <%= 15.days.ago.to_s(:db) %>    updated_at: <%= 15.days.ago.to_s(:db) %> ... administrator_of_two:     name: administrator     authorizable: two (Franchise)     users: mickey     <<: *DEFAULTS

no need for a users_roles.yaml file the users_roles data are created into the table, BUT.... the timestamps ARE NOT set in the roles_users table...

any clue ?

thanks

erwin

Hi all , (environment : Rails 2.1, Authorization Plugin)

I am setting up fixtures (w autogenerated IDs) , but I am stuck with the following issue w the roles_users table

Extra attributes on habtm join tables is kinds deprecated, so I
wouldn't be surprised if the foxy fixtures stuff (which was only added
in 2.0) didn't support it.

Fred

Hi Fred, thanks for being there...

I looked into activerecord-2.1.0/lib/active_record/fixtures.rb to see if the foxy fixtures stuff was there... it's not (I discovered this patch goggling a little bit..)

I 'll try to patch it.. but I neved did that before.. once I get the .diff file, how can I do that ? I can suppress/add lines by hand, but I suppose there is a fancy way to do it

erwin

Hi Fred, thanks for being there...

I looked into activerecord-2.1.0/lib/active_record/fixtures.rb to see if the foxy fixtures stuff was there... it's not (I discovered this patch goggling a little bit..)

It must be or you'd have to have a user_roles.yml file. Foxy fixtures
is just a name - I wouldn't be surprised if that string didn't appear
anywhere in it

Fred

I modified the fixtures.rb , according to the patch, and it runs well... I get the timestamps OK in the generated users_roles table.. even if HABTM is deprecated, the Authorization Plugin is still using it.... good question asked in Authorization Plugin group

thanks