Yes, I did. I have a file db/migrate/20100212201914_add_publisher_role.rb:
> class AddPublisherRole < ActiveRecord::Migration
> def self.up
> Role.enumeration_model_updates_permitted = true
> Role.create(:name => 'publisher')
> Role.enumeration_model_updates_permitted = false
> end
>
> def self.down
> pub = Role.find_by_name("publisher")
> unless pub.nil?
> Role.enumeration_model_updates_permitted = true
> pub.destroy
> Role.enumeration_model_updates_permitted = false
> end
> end
> end
On Mar 15, 2010, at 6:40 AM, Bruno Bornsztein wrote:
> Did you add the new role in a migration as well? Look at 056_create_roles.rb
>
>
>
> On Sat, Mar 13, 2010 at 8:19 PM, Patrick Minton <[email protected]>
> wrote:
> I added a new role to the Role model. However, I can't test it because
> whenever I run the tests I get:
>
> mbpatrick:thecommunity patrick$ ruby test/unit/ad_test.rb
> /Users/patrick/src/hylo/thecommunity/vendor/plugins/community_engine/plugins/enumerations_mixin/lib/active_record/acts/enumerated.rb:125:in
> `enforce_strict_literals': Couldn't find a Role identified by (:publisher)
> (ActiveRecord::RecordNotFound)
>
> Before you ask, yes, I have added the :publisher role to the fixture roles.yml
>
> The problem as far as I can tell is that the error is occurring when it loads
> environment.rb, which loads the User model, which references my new role.
> All of this occurs before any migration can take place (because compilation
> fails before migration).
>
> Any ideas how I get around this? Seems like a chicken/egg problem
>
> Patrick
>
> --
> You received this message because you are subscribed to the Google Groups
> "CommunityEngine" 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/communityengine?hl=en.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "CommunityEngine" 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/communityengine?hl=en.
--
You received this message because you are subscribed to the Google Groups
"CommunityEngine" 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/communityengine?hl=en.