Class: Spree::Transit::BranchesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/transit/branches_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#collection_url, #current_vendor, #edit_object_url, #page, #per_page, #required_vendor_user!, #vendors

Instance Method Details

#branch_paramsObject



30
31
32
# File 'app/controllers/spree/transit/branches_controller.rb', line 30

def branch_params
  params.require(:branch).permit(:name, :lat, :lon)
end

#collectionObject



9
10
11
12
13
14
15
16
# File 'app/controllers/spree/transit/branches_controller.rb', line 9

def collection
  return @collection if defined?(@collection)

  current_vendor.branches

  @search = current_vendor.branches.includes(:state).ransack(params[:q])
  @collection = @search.result
end

#location_after_saveObject



18
19
20
# File 'app/controllers/spree/transit/branches_controller.rb', line 18

def location_after_save
  transit_branches_url
end

#model_classObject



22
23
24
# File 'app/controllers/spree/transit/branches_controller.rb', line 22

def model_class
  SpreeCmCommissioner::Branch
end

#newObject



4
5
6
7
# File 'app/controllers/spree/transit/branches_controller.rb', line 4

def new
  @branch = SpreeCmCommissioner::Branch.new
  super
end

#object_nameObject



26
27
28
# File 'app/controllers/spree/transit/branches_controller.rb', line 26

def object_name
  'spree_cm_commissioner_branch'
end