Browse Source

Make it possible to limit roles by date

eperez-timeinput
Jason Denney 12 years ago
parent
commit
a614b28558
  1. 2
      app/models/user.rb
  2. 2
      app/models/user_role_join.rb

2
app/models/user.rb

@ -14,7 +14,7 @@ class User < ActiveRecord::Base
has_many :user_profiles has_many :user_profiles
accepts_nested_attributes_for :user_profiles, allow_destroy: false accepts_nested_attributes_for :user_profiles, allow_destroy: false
has_many :user_role_joins has_many :user_role_joins, :conditions => ["ends IS NULL OR ends > ?", Time.now]
has_many :roles, through: :user_role_joins has_many :roles, through: :user_role_joins
belongs_to :bike belongs_to :bike

2
app/models/user_role_join.rb

@ -1,6 +1,6 @@
class UserRoleJoin < ActiveRecord::Base class UserRoleJoin < ActiveRecord::Base
set_table_name :user_role_joins set_table_name :user_role_joins
attr_accessible :role_id, :user_id attr_accessible :role_id, :user_id, :ends
belongs_to :user belongs_to :user
belongs_to :role belongs_to :role

Loading…
Cancel
Save