lib/generators/effective/ability_generator.rb in effective_developer-0.8.2 vs lib/generators/effective/ability_generator.rb in effective_developer-0.8.3

- old
+ new

@@ -51,13 +51,15 @@ if non_crud_actions.present? abilities += non_crud_actions end - abilities = ['manage'] if abilities.blank? || abilities == (crud_actions - ['show']) + abilities = ['crud'] if abilities.blank? || abilities == (crud_actions - ['show']) - if abilities.length == 1 + if abilities == ['crud'] + abilities = "#{abilities.first}" + elsif abilities.length == 1 abilities = ":#{abilities.first}" else abilities = '[' + abilities.map { |action| ':' + action }.join(', ') + ']' end @@ -65,10 +67,10 @@ resource.class_name.split('::').last else resource.class_name end - "can #{abilities}, #{name}" + "can(#{abilities}, #{name})" ) end end end end