Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # SHOWS CONTROLLER - WORKS
- class Cp::ShowsController < Cp::BaseController
- layout "cp"
- def index
- @shows = Show.find(:all)
- end
- def new
- @show = Show.new
- @days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
- @hours = 00.upto(23)
- end
- def create
- @show = Show.new(params[:cp_show])
- if @show.save
- flash[:notice] = "Show created, brosef."
- redirect_to cp_shows_path
- else
- render :action => 'index'
- end
- end
- end
- # USERS CONTROLLER - DOESN'T WORK
- class Cp::UsersController < Cp::BaseController
- layout "cp"
- def index
- @users = User.find(:all)
- end
- def new
- @user = User.new
- @species = ['admin', 'management', 'dj']
- end
- def create
- @user = User.new(params[:cp_user])
- @user.dj_name = @user.name
- @user.status = 'inactive'
- @user.about = 'Fill me in.'
- @user.page_content = 'Listen to this show plzkthxbye.'
- @user.password = 'temp'
- # Create Login: John Doe => jdoe
- @user.login = @user.name.downcase
- @user_names = @user.login.split(pattern = ' ')
- @user.login = @user_names[0].first
- @user.login += @user_names[1]
- if @user.save
- flash[:notice] = "User created, brosef."
- redirect_to cp_users_path
- else
- render :action => 'new'
- end
- end
- end
Add Comment
Please, Sign In to add comment