Moved owner_id set to model based on current user.
This commit is contained in:
parent
e9a21228ec
commit
d55cb0ec75
2 changed files with 5 additions and 4 deletions
|
@ -18,7 +18,6 @@ class TaskbarController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
params[:user_id] = current_user.id
|
||||
model_create_render(Taskbar,params)
|
||||
end
|
||||
|
||||
|
@ -26,7 +25,6 @@ class TaskbarController < ApplicationController
|
|||
taskbar = Taskbar.find( params[:id] )
|
||||
return if !access(taskbar)
|
||||
|
||||
params[:user_id] = current_user.id
|
||||
taskbar.update_attributes!( Taskbar.param_cleanup(params) )
|
||||
model_update_render_item(taskbar)
|
||||
end
|
||||
|
|
|
@ -3,11 +3,14 @@
|
|||
class Taskbar < ApplicationModel
|
||||
store :state
|
||||
store :params
|
||||
before_create :update_last_contact
|
||||
before_update :update_last_contact
|
||||
before_create :update_last_contact, :set_user
|
||||
before_update :update_last_contact, :set_user
|
||||
|
||||
private
|
||||
def update_last_contact
|
||||
self.last_contact = Time.now
|
||||
end
|
||||
def set_user
|
||||
self.user_id = UserInfo.current_user_id
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue