agenda-libre-ruby/app/controllers/lugs_controller.rb

25 lines
564 B
Ruby

# Groups life cycle
class LugsController < ApplicationController
before_action :set_lug, only: [:show]
def index
@search = Lug.search params[:q]
@search.sorts = 'name' if @search.sorts.empty?
@lugs = @search.result.page params[:page]
end
def show
@search = Lug.search params[:q]
@events_future = Event.moderated.future.tag @lug.name
@events_past = Event.moderated.past.tag @lug.name
end
private
# Use callbacks to share common setup or constraints between actions.
def set_lug
@lug = Lug.find params[:id]
end
end