Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
rails has_one with a proc.
class Project
# as above
has_one :project_department, ->(department) { where department: department }, class_name: 'ProjectDepartment'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment