课程allow_join方法增加课程的传入,减少课程获取次数

This commit is contained in:
sw 2014-10-21 08:55:55 +08:00
parent 22a5d6a6b0
commit 6530c657ee
1 changed files with 3 additions and 3 deletions

View File

@ -29,7 +29,7 @@ class CoursesController < ApplicationController
if course if course
@state = 4 @state = 4
else else
unless (allow_join && User.current.member_of_course?(course)) unless (allow_join(course) && User.current.member_of_course?(course))
if params[:course_password] == course.password if params[:course_password] == course.password
members = [] members = []
members << Member.new(:role_ids => [10], :user_id => User.current.id) members << Member.new(:role_ids => [10], :user_id => User.current.id)
@ -700,8 +700,8 @@ class CoursesController < ApplicationController
private private
def allow_join def allow_join course
if course_endTime_timeout? Course.find(params[:object_id]) if course_endTime_timeout? course
respond_to do |format| respond_to do |format|
format.js { format.js {
@state = 2 @state = 2