Class: Spree::Transit::LocationsController
- Inherits:
-
BaseController
- Object
- Admin::ResourceController
- BaseController
- Spree::Transit::LocationsController
show all
- Defined in:
- app/controllers/spree/transit/locations_controller.rb
Instance Method Summary
collapse
#collection_url, #current_vendor, #edit_object_url, #page, #per_page, #required_vendor_user!, #vendors
Instance Method Details
#collection ⇒ Object
16
17
18
19
20
21
22
23
|
# File 'app/controllers/spree/transit/locations_controller.rb', line 16
def collection
return @collection if defined?(@collection)
load_location
@search = @locations.ransack(params[:q])
@collection = @search.result
end
|
#load_country ⇒ Object
8
9
10
|
# File 'app/controllers/spree/transit/locations_controller.rb', line 8
def load_country
@countries = Spree::Country.where(id: current_vendor.default_country)
end
|
#load_location ⇒ Object
4
5
6
|
# File 'app/controllers/spree/transit/locations_controller.rb', line 4
def load_location
@locations = Spree::State.all
end
|
#location_after_save ⇒ Object
25
26
27
|
# File 'app/controllers/spree/transit/locations_controller.rb', line 25
def location_after_save
transit_locations_url
end
|
#model_class ⇒ Object
29
30
31
|
# File 'app/controllers/spree/transit/locations_controller.rb', line 29
def model_class
Spree::State
end
|
#new ⇒ Object
12
13
14
|
# File 'app/controllers/spree/transit/locations_controller.rb', line 12
def new
@object.country_id = Spree::Country.find_by(id: current_vendor.default_country)&.id
end
|
#object_name ⇒ Object
33
34
35
|
# File 'app/controllers/spree/transit/locations_controller.rb', line 33
def object_name
'state'
end
|