class RightOn::Generators::RightMigrationGenerator
Public Instance Methods
generate_migration()
click to toggle source
# File lib/right_on/generators/right_migration_generator.rb, line 19 def generate_migration raise ArgumentError, "Either name or controller must be specified" if right_controller.blank? migration_template "right_migration.rb", "db/migrate/add_#{parsed_right_name}_right.rb" end
Private Instance Methods
parsed_right_name()
click to toggle source
# File lib/right_on/generators/right_migration_generator.rb, line 53 def parsed_right_name right_name.gsub('/','_').gsub('#','_').underscore end
right_action()
click to toggle source
# File lib/right_on/generators/right_migration_generator.rb, line 38 def right_action (options[:action] || name.to_s.split('#')[1]).to_s.underscore.presence end
right_controller()
click to toggle source
# File lib/right_on/generators/right_migration_generator.rb, line 33 def right_controller (options[:controller] || name.to_s.split('#')[0]).to_s.underscore.presence end
right_for_roles()
click to toggle source
# File lib/right_on/generators/right_migration_generator.rb, line 48 def right_for_roles options[:right] end
right_name()
click to toggle source
# File lib/right_on/generators/right_migration_generator.rb, line 43 def right_name name.presence || [right_controller, right_action].compact.join('#') end