1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Use consistent references

This commit is contained in:
David Heinemeier Hansson 2015-12-17 14:30:21 +01:00
parent 748b21db8f
commit b708a6050c

View file

@ -19,7 +19,7 @@
private
def set_current
Current.account = Account.find(params[:account_id])
Current.person = Current.account.people.find(params[:person_id])
Current.user = Current.account.users.find(params[:user_id])
end
end
@ -40,8 +40,8 @@
end
class Event < ApplicationRecord
belongs_to :creator, class_name: 'Person'
before_validation { self.creator ||= Current.person }
belongs_to :creator, class_name: 'User'
before_validation { self.creator ||= Current.user }
end
*DHH*