Class: Nandi::NotNullCheckGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Nandi::NotNullCheckGenerator
- Includes:
- Formatting
- Defined in:
- lib/generators/nandi/not_null_check/not_null_check_generator.rb
Instance Attribute Summary collapse
-
#add_not_null_check_name ⇒ Object
readonly
Returns the value of attribute add_not_null_check_name.
-
#validate_not_null_check_name ⇒ Object
readonly
Returns the value of attribute validate_not_null_check_name.
Instance Method Summary collapse
Methods included from Formatting
Instance Attribute Details
#add_not_null_check_name ⇒ Object (readonly)
Returns the value of attribute add_not_null_check_name.
16 17 18 |
# File 'lib/generators/nandi/not_null_check/not_null_check_generator.rb', line 16 def add_not_null_check_name @add_not_null_check_name end |
#validate_not_null_check_name ⇒ Object (readonly)
Returns the value of attribute validate_not_null_check_name.
16 17 18 |
# File 'lib/generators/nandi/not_null_check/not_null_check_generator.rb', line 16 def validate_not_null_check_name @validate_not_null_check_name end |
Instance Method Details
#add_not_null_check ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/generators/nandi/not_null_check/not_null_check_generator.rb', line 18 def add_not_null_check self.table = table.to_sym self.column = column.to_sym @add_not_null_check_name = "add_not_null_check_on_#{column}_to_#{table}" template( "add_not_null_check.rb", "#{base_path}/#{}_#{add_not_null_check_name}.rb", ) end |
#validate_not_null_check ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/generators/nandi/not_null_check/not_null_check_generator.rb', line 30 def validate_not_null_check self.table = table.to_sym self.column = column.to_sym @validate_not_null_check_name = "validate_not_null_check_on_#{column}_to_#{table}" template( "validate_not_null_check.rb", "#{base_path}/#{(1)}_#{validate_not_null_check_name}.rb", ) end |