diff --git a/app/models/user.rb b/app/models/user.rb index 9de57d2..17be074 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -14,7 +14,7 @@ class User < ActiveRecord::Base has_many :user_profiles 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 belongs_to :bike diff --git a/app/models/user_role_join.rb b/app/models/user_role_join.rb index 64b961a..f55b93c 100644 --- a/app/models/user_role_join.rb +++ b/app/models/user_role_join.rb @@ -1,6 +1,6 @@ class UserRoleJoin < ActiveRecord::Base set_table_name :user_role_joins - attr_accessible :role_id, :user_id + attr_accessible :role_id, :user_id, :ends belongs_to :user belongs_to :role