Fix WikiPage.from_param
This commit is contained in:
@@ -88,6 +88,6 @@ class Course < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def self.from_param(param)
|
||||
param.is_numeric? ? Course.find(param) : Course.find_by_short_name(param)
|
||||
param.is_numeric? ? Course.find(param) : Course.find_by_short_name!(param)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -79,11 +79,11 @@ class WikiPage < ActiveRecord::Base
|
||||
canonical_title || id
|
||||
end
|
||||
|
||||
def self.from_param(param)
|
||||
def self.from_param(course, param)
|
||||
if param.is_numeric?
|
||||
WikiPage.find!(param)
|
||||
course.wiki_pages.find(param)
|
||||
else
|
||||
WikiPage.find_by_canonical_title!(param)
|
||||
course.wiki_pages.find_by_canonical_title!(param)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user