48 lines
984 B
Ruby
48 lines
984 B
Ruby
class JamSessionsController < ApplicationController
|
|
|
|
# have to be signed in currently to see this screen
|
|
before_filter :signed_in_user
|
|
|
|
def index
|
|
@jam_sessions = JamSession.paginate(page: params[:page])
|
|
end
|
|
|
|
def show
|
|
@jam_session = JamSession.find(params[:id])
|
|
|
|
# use gon to pass variables into javascript
|
|
gon.websocket_gateway_uri = Rails.application.config.websocket_gateway_uri
|
|
gon.jam_session_id = @jam_session.id
|
|
end
|
|
|
|
def new
|
|
@jam_session = JamSession.new
|
|
end
|
|
|
|
def create
|
|
@jam_session = JamSession.new()
|
|
@jam_session.creator = current_user
|
|
@jam_session.name = params[:jam_ruby_jam_session][:name]
|
|
if @jam_session.save
|
|
flash[:success] = "Jam Session created"
|
|
redirect_to @jam_session
|
|
else
|
|
render 'new'
|
|
end
|
|
end
|
|
|
|
def edit
|
|
end
|
|
|
|
def update
|
|
|
|
end
|
|
|
|
def destroy
|
|
JamSession.find(params[:id]).destroy
|
|
flash[:success] = "Jam Session deleted."
|
|
redirect_to jam_sessions_url
|
|
end
|
|
|
|
end
|