So I'm working on creating a migration for a new version of one of the
projects I'm working on. But Rake seems to be selectively spitting out
errors. The same code that works only a few lines up will not work
where I most need it. (That should be a law of programming...)
So here's what's up. I've got a table that stores information on the
roles that users can have. There are four columns: id, name,
parent_id, and list_priority. The big key feature that I'm
implementing in this release is the concept of permission inheritance
across roles. So, what I've done for some roles is the following:
puts ' -> Remove developer permissions collection'
puts ' -> Set developer parent and list_priority'
@officerRole.id, :list_priority => 5)
The migration handles that fine. However it throws an error on:
@serviceChair = Role.create :name => 'Service Chair'
@brotherRole.id, :list_priority => 3)
@serviceChair.permissions << @op_login
@serviceChair.permissions << @op_service_fundraising
The rake error reads as follows:
undefined method `list_priority=' for #<Role id: 5, name: "Service
And, if I remove list_priority from the update_attributes method in
the second code segment, it will throw a similar error about
parent_id. Could anyone tell me what the heck is going on here? I'm
about at the end of my wits trying to figure this out.
Thanks in advance.