Class: SimpleAddress::Region

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/simple_address/region.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.search(params) ⇒ Object



7
8
9
10
11
# File 'app/models/simple_address/region.rb', line 7

def self.search(params)
  where(country_id: params[:country_id]).where(
    'name LIKE ?', "#{params[:name]}%"
  )
end

Instance Method Details

#country_nameObject



13
14
15
# File 'app/models/simple_address/region.rb', line 13

def country_name
  country.name if country
end