mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-27 04:51:14 +00:00
e59e8ac8e7
- Add .params to models and update controllers - Add afk time to gather - Reannotate models - Fix rspec problem by using latest rspec plugins from github
31 lines
626 B
Ruby
31 lines
626 B
Ruby
# == Schema Information
|
|
#
|
|
# Table name: locks
|
|
#
|
|
# id :integer not null, primary key
|
|
# lockable_type :string(255)
|
|
# created_at :datetime
|
|
# updated_at :datetime
|
|
# lockable_id :integer
|
|
#
|
|
# Indexes
|
|
#
|
|
# index_locks_on_lockable_id_and_lockable_type (lockable_id,lockable_type)
|
|
#
|
|
|
|
class Lock < ActiveRecord::Base
|
|
include Extra
|
|
belongs_to :lockable, :polymorphic => true
|
|
|
|
def can_create? cuser
|
|
cuser and cuser.admin?
|
|
end
|
|
|
|
def can_destroy? cuser
|
|
cuser and cuser.admin?
|
|
end
|
|
|
|
def self.params(params, cuser)
|
|
params.require(:lock).permit(:lockable_type, :lockable_id)
|
|
end
|
|
end
|