My quick solution was to add a link wrapped within a
Rails.env=='development' check that triggers the following method

def reload_abilities
Spree::Ability.register_ability(SupplierAbility)
Spree::Ability.register_ability(AdminAbility)
redirect_to :root
end

Now I just need to click that link instead of restarting the server.
On Thursday, January 31, 2013 10:03:04 PM UTC-8, Sunil Gowda wrote:

Hi All,
I have a bunch of custom abilities added to a new role. All that is
working very well. However, whenever I make a code change (template edits
are fine), my custom abilities are gone. This is major pain during
development as I have to restart the server on every code change. Is anyone
else experiencing this?

After debugging a bit, I have traced it to a few spots, but I am not sure
how to fix it. CanCan's @current_ability is reset to nil (at some
unidentified location) and assigned to a new Spree::Ability instance in
Spree::Core::ControllerHelper's current_ability method. Since the
initializers are not executed, the new abilities are not registered.

Any help is greatly appreciated.

Cheers!
Sunil Gowda
--
You received this message because you are subscribed to the Google Groups "Spree" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spree-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 2 | next ›
Discussion Overview
groupspree-user @
categoriesrubyonrails
postedFeb 1, '13 at 7:58a
activeFeb 2, '13 at 4:16a
posts2
users1
websitespreecommerce.com
irc#RubyOnRails

1 user in discussion

Sunil Gowda: 2 posts

People

Translate

site design / logo © 2022 Grokbase