Module: Rails::MarkRequirements

Defined in:
lib/rails/mark_requirements.rb,
lib/rails/mark_requirements/version.rb,
lib/generators/rails/mark_requirements/install_generator.rb

Defined Under Namespace

Modules: ClassMethods Classes: InstallGenerator

Constant Summary collapse

VERSION =
'0.0.1'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object

Allow the developer to be lazy and auto-extend the class methods, which is required for the instance method to work anyway



8
9
10
# File 'lib/rails/mark_requirements.rb', line 8

def self.included(klass) # :nodoc:
  klass.extend ClassMethods
end

Instance Method Details

#mark_required?(attribute) ⇒ Boolean

:call-seq: mark_required? :attribute

does field_for(object.attribute) require ‘a presence’

Returns:

  • (Boolean)


31
32
33
# File 'lib/rails/mark_requirements.rb', line 31

def mark_required?(attribute)
  self.class.mark_required?(attribute)
end