Class: Admin::GoalsController
- Inherits:
-
AdminController
- Object
- AdminController
- Admin::GoalsController
- Defined in:
- app/controllers/admin/goals_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #scores ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/admin/goals_controller.rb', line 21 def create @goal = Goal.new(params[:goal]) @goal.system_id = _sid @goal.user_id = current_user.id if @goal.save redirect_to [:admin, @goal], :notice => "Successfully created Goal" and return logger.debug "x" else render :action => 'new' logger.debug "y" end end |
#destroy ⇒ Object
48 49 50 51 52 |
# File 'app/controllers/admin/goals_controller.rb', line 48 def destroy @goal = Goal.find_sys_id(_sid, params[:id]) @goal.destroy redirect_to admin_goals_url, :notice => "Successfully destroyed Goal" end |
#edit ⇒ Object
35 36 37 |
# File 'app/controllers/admin/goals_controller.rb', line 35 def edit @goal = Goal.find_sys_id(_sid,params[:id]) end |
#index ⇒ Object
9 10 11 |
# File 'app/controllers/admin/goals_controller.rb', line 9 def index @goals = Goal.sys(_sid).all end |
#new ⇒ Object
17 18 19 |
# File 'app/controllers/admin/goals_controller.rb', line 17 def new @goal = Goal.new end |
#scores ⇒ Object
3 4 5 6 7 |
# File 'app/controllers/admin/goals_controller.rb', line 3 def scores @goal = Goal.sys(_sid).where(:id=>params[:id]).first @scores = @goal.goals_users.includes(:user).page(params[:page]).per(100) end |
#show ⇒ Object
13 14 15 |
# File 'app/controllers/admin/goals_controller.rb', line 13 def show @goal = Goal.find_sys_id(_sid, params[:id]) end |
#update ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'app/controllers/admin/goals_controller.rb', line 39 def update @goal = Goal.find_sys_id(_sid,params[:id]) if @goal.update_attributes(params[:goal]) redirect_to [:admin, @goal], :notice => "Successfully updated Goal" else render :action => 'edit' end end |