module AuthorizedRailsScaffolds::Macros::AttributeMacros

requires attributes to be defined

Public Instance Methods

datetime_attributes() click to toggle source
# File lib/authorized_rails_scaffolds/macros/attribute_macros.rb, line 30
def datetime_attributes
  @datetime_attributes ||= output_attributes.reject{|attribute| ![:time, :date, :datetime].include? attribute.type }
end
output_attributes() click to toggle source
# File lib/authorized_rails_scaffolds/macros/attribute_macros.rb, line 6
def output_attributes
  unless @output_attributes
    @output_attributes = []

    # First attribute
    @output_attributes << attributes.first unless attributes.empty?

    # Reference Attribtues
    @output_attributes += attributes[1..-1].reject{|attribute| ![:references].include? attribute.type }

    # Standard Attributes
    @output_attributes += attributes[1..-1].reject{|attribute| [:references].include? attribute.type }
  end
  @output_attributes
end
references_attributes() click to toggle source
# File lib/authorized_rails_scaffolds/macros/attribute_macros.rb, line 22
def references_attributes
  @references_attributes ||= output_attributes.reject{|attribute| ![:references].include? attribute.type }
end
standard_attributes() click to toggle source
# File lib/authorized_rails_scaffolds/macros/attribute_macros.rb, line 26
def standard_attributes
  @standard_attributes ||= output_attributes.reject{|attribute| [:time, :date, :datetime, :references].include? attribute.type }
end