Skip to content

Commit

Permalink
Comment out one unused method in admin_controller.
Browse files Browse the repository at this point in the history
  • Loading branch information
yangsong8 committed Sep 5, 2015
1 parent 58415ae commit aaaf7ff
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions app/controllers/admin_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,26 @@ def new_instructor
end
end

def create_instructor
if params['save']
@user = User.find_or_create_by_name params[:user][:name]
@user.role = Role.instructor
@user.update_attributes(params[:user])
redirect_to :action => 'list_instructors'
else
@user = User.new(params[:user])
@user.parent_id = (session[:user]).id
@user.role_id = Role.instructor.id

if @user.save
flash[:notice] = 'Instructor was successfully created.'
redirect_to :action => 'list_instructors'
else
render :action => 'new_instructor'
end
end
end

# def create_instructor
# if params['save']
# @user = User.find_or_create_by_name params[:user][:name]
# @user.role = Role.instructor
# @user.update_attributes(params[:user])
# redirect_to :action => 'list_instructors'
# else
# @user = User.new(params[:user])
# @user.parent_id = (session[:user]).id
# @user.role_id = Role.instructor.id
#
# if @user.save
# flash[:notice] = 'Instructor was successfully created.'
# redirect_to :action => 'list_instructors'
# else
# render :action => 'new_instructor'
# end
# end
# end

def list_instructors
@users = User.
Expand Down

1 comment on commit aaaf7ff

@yangsong8
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In admin_controller, we have methods to create instructors. Those code are currently broken. If they works, super_admin should be able to login -> "Administration"->"show..."->"instructor" and new instructors can be added here.
image

Another place to create instructors is to login as super admin and "manage"->"users", stroll down to the very bottom and click "new user".

Those 2 ways can both create new instructors, but they do not share code, and the first approach is broken. Shall we create one OSS project to have some students fix this?

Please sign in to comment.