routing fixes

This commit is contained in:
albert
2013-02-17 00:59:19 -05:00
parent 301bbbfde5
commit 74c0cee5ee
5 changed files with 26 additions and 1 deletions

View File

@@ -2,6 +2,16 @@ class ModAction < ActiveRecord::Base
belongs_to :creator, :class_name => "User"
before_validation :initialize_creator, :on => :create
def self.search(params = {})
q = scoped()
if params[:creator_id]
q = q.where("creator_id = ?", params[:creator_id].to_i)
end
q
end
def initialize_creator
self.creator_id = CurrentUser.id
end