Skip to content

Commit 0fa839b

Browse files
authoredJun 3, 2020
Update missing context in guides/concepts/resources.md (#32)
This commit updates `guides/concepts/resources.md` with the missing `class_name: 'Position'` and `resource: PositionResource` options respectively.
1 parent 70e6518 commit 0fa839b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

Diff for: ‎guides/concepts/resources.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1127,7 +1127,7 @@ array. Consider this `ActiveRecord` relationship:
11271127
{% highlight ruby %}
11281128
# app/models/employee.rb
11291129
has_many :positions
1130-
has_one :current_position, -> { where(created_at: :desc) }
1130+
has_one :current_position, -> { where(created_at: :desc) }, class_name: 'Position'
11311131

11321132
Employee.includes('current_position').to_a
11331133

@@ -1144,7 +1144,7 @@ The same thing happens in Graphiti:
11441144
{% highlight ruby %}
11451145
# app/resources/employee_resource.rb
11461146
has_many :positions
1147-
has_one :current_position do
1147+
has_one :current_position, resource: PositionResource do
11481148
params do |hash|
11491149
hash[:sort] = '-created_at'
11501150
end
@@ -1169,7 +1169,7 @@ where a value of `1` meant "most recent":
11691169
{% highlight ruby %}
11701170
# app/models/employee.rb
11711171
has_many :positions
1172-
has_one :current_position, -> { where(historical_index: 1) }
1172+
has_one :current_position, -> { where(historical_index: 1) }, class_name: 'Position'
11731173

11741174
Employee.includes('current_position').to_a
11751175

0 commit comments

Comments
 (0)
Please sign in to comment.