Class: Nandi::CheckConstraintGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Nandi::CheckConstraintGenerator
- Includes:
- Formatting
- 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 Formatting
Instance Attribute Details
#add_check_constraint_name ⇒ Object (readonly)
Returns the value of attribute add_check_constraint_name.
16 17 18 |
# File 'lib/generators/nandi/check_constraint/check_constraint_generator.rb', line 16 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.
16 17 18 |
# File 'lib/generators/nandi/check_constraint/check_constraint_generator.rb', line 16 def validate_check_constraint_name @validate_check_constraint_name end |
Instance Method Details
#add_check_constraint ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/generators/nandi/check_constraint/check_constraint_generator.rb', line 18 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}/#{timestamp}_#{add_check_constraint_name}.rb", ) end |
#validate_check_constraint ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/generators/nandi/check_constraint/check_constraint_generator.rb', line 30 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}/#{timestamp(1)}_#{validate_check_constraint_name}.rb", ) end |