Sha256: 5ee4d9c2625fcee6a3b78530b47b5dd3611cfe5358d14e3201ce0e569a39dab5

Contents?: true

Size: 260 Bytes

Versions: 5

Compression:

Stored size: 260 Bytes

Contents

class <%= model_name %> < ActiveRecord::Base

  attr_accessible :name, :abbreviation

  validates :name, uniqueness: {scope: :abbreviation}

  scope :for_abbreviation, ->(abbrev){where(abbreviation: abbrev)}

  scope :for_name, ->(name){where(name: name)}

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
looky-lu-0.0.5 lib/generators/lookylu/templates/states_model.erb
looky-lu-0.0.4 lib/generators/lookylu/templates/states_model.erb
looky-lu-0.0.3 lib/generators/lookylu/templates/states_model.erb
looky-lu-0.0.2 lib/generators/lookylu/templates/states_model.erb
looky-lu-0.0.1 lib/generators/lookylu/templates/states_model.erb