clarion/app/controllers/management/conferences_controller.rb

34 lines
749 B
Ruby
Raw Normal View History

2014-10-14 18:27:28 +03:00
module Management
class ConferencesController < ManagementController
before_action :assign_conference, only: [:edit]
def new
@conference = Conference.new
3.times { @conference.tracks.build }
end
def create
@conference = Conference.new conference_params
@conference.save
render :new
end
def edit
end
2014-10-14 20:34:33 +03:00
def index
@conferences = Conference.all.order(start_date: :desc)
end
2014-10-14 18:27:28 +03:00
private
def assign_conference
@conference = Conference.find params[:id]
end
def conference_params
params.require(:conference).permit [:title, :email, :start_date, :end_date, :description, tracks_attributes: [:id, :name, :color, :description, :_destroy]]
end
end
end