conversionfoundry / breeze

A Ruby on Rails CMS for brochure-style websites.
Other
3 stars 2 forks source link

run_hook changes classes to arrays #45

Open isaacfreeman opened 12 years ago

isaacfreeman commented 12 years ago

When run_hook is passed an initial_value parameter, it comes through to the destination hook method as an array. This is usually OK because we mostly intend to pass arrays, but it's no good for the define_abilities hook, which needs to work on a CanCan::Ability, not a plain array.

I'm bypassing this in Breeze Commerce by passing the CanCan::Ability a second time as an argument, which works fine but results in the ugly call

Breeze.run_hook :define_abilities, self, user, self

... where the first self is converted into an array and ignored, and the second one passes through as a CanCan::Ability which Breeze::Commerce adds to.