mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
10 lines
272 B
Ruby
10 lines
272 B
Ruby
class Suburb < ActiveRecord::Base
|
|
belongs_to :state, :class_name => Spree::State
|
|
|
|
delegate :name, to: :state, prefix: true
|
|
|
|
scope :matching , ->(term) {
|
|
where("lower(name) like ? or cast(postcode as text) like ?", "%#{term.to_s.downcase}%", "%#{term}%")
|
|
}
|
|
end
|