Class: Nandi::CheckConstraintGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Nandi::CheckConstraintGenerator
- Includes:
- Formatting, MultiDbGenerator
- Defined in:
- lib/generators/nandi/check_constraint/check_constraint_generator.rb
Instance Attribute Summary collapse
-
#add_check_constraint_name ⇒ Object
readonly
Returns the value of attribute add_check_constraint_name.
-
#validate_check_constraint_name ⇒ Object
readonly
Returns the value of attribute validate_check_constraint_name.
Instance Method Summary collapse
Methods included from MultiDbGenerator
Methods included from Formatting
Instance Attribute Details
#add_check_constraint_name ⇒ Object (readonly)
Returns the value of attribute add_check_constraint_name.
18 19 20 |
# File 'lib/generators/nandi/check_constraint/check_constraint_generator.rb', line 18 def add_check_constraint_name @add_check_constraint_name end |
#validate_check_constraint_name ⇒ Object (readonly)
Returns the value of attribute validate_check_constraint_name.
18 19 20 |
# File 'lib/generators/nandi/check_constraint/check_constraint_generator.rb', line 18 def validate_check_constraint_name @validate_check_constraint_name end |
Instance Method Details
#add_check_constraint ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/generators/nandi/check_constraint/check_constraint_generator.rb', line 20 def add_check_constraint self.table = table.to_sym self.name = name.to_sym @add_check_constraint_name = "add_check_constraint_#{name}_on_#{table}" template( "add_check_constraint.rb", "#{base_path}/#{}_#{add_check_constraint_name}.rb", ) end |
#validate_check_constraint ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/generators/nandi/check_constraint/check_constraint_generator.rb', line 32 def validate_check_constraint self.table = table.to_sym self.name = name.to_sym @validate_check_constraint_name = "validate_check_constraint_#{name}_on_#{table}" template( "validate_check_constraint.rb", "#{base_path}/#{(1)}_#{validate_check_constraint_name}.rb", ) end |