Skip to content

Commit 2882008

Browse files
committed
Lint fixes
1 parent 8ed3405 commit 2882008

File tree

5 files changed

+16
-18
lines changed

5 files changed

+16
-18
lines changed

lib/graphiti/resource/persistence.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ def assign(assign_params, meta = nil, action_name = nil)
7676

7777
run_callbacks :attributes, action_name, assign_params, meta do |params|
7878
model_instance = if action_name != :create && id
79-
self.class._find(id: id).data
80-
else
81-
call_with_meta(:build, model, meta)
82-
end
79+
self.class._find(id: id).data
80+
else
81+
call_with_meta(:build, model, meta)
82+
end
8383
call_with_meta(:assign_attributes, model_instance, params, meta)
8484
model_instance
8585
end

lib/graphiti/resource_proxy.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ def data
8181
end
8282
end
8383

84-
alias to_a data
85-
alias resolve_data data
84+
alias_method :to_a, :data
85+
alias_method :resolve_data, :data
8686

8787
def meta
8888
@meta ||= data.respond_to?(:meta) ? data.meta : {}

lib/graphiti/serializer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def strip_relationships!(hash)
9898
end
9999

100100
def strip_relationships?
101-
return false unless Graphiti.config.links_on_demand
101+
return false unless Graphiti.config.links_on_demand
102102

103103
params = Graphiti.context[:object].try(:params) || {}
104104
[false, nil, "false"].include?(params[:links])

spec/integration/rails/callbacks_spec.rb

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ApplicationResource < Graphiti::Resource
3535

3636
class EmployeeResource < ApplicationResource
3737
self.model = Employee
38-
self.type= "employees"
38+
self.type = "employees"
3939

4040
before_attributes :one
4141
before_attributes :two
@@ -208,7 +208,7 @@ def params
208208
{
209209
data: {
210210
type: "employees",
211-
attributes: { first_name: "Jane"}
211+
attributes: {first_name: "Jane"}
212212
}
213213
}
214214
end
@@ -244,16 +244,14 @@ def params
244244
describe "update callbacks" do
245245
let!(:employee) { Employee.create!(first_name: "asdf") }
246246
let(:payload) {
247-
{ id: employee.id,
248-
data: {
249-
id: employee.id,
250-
type: 'employees',
251-
attributes: { first_name: "Jane" }
252-
}
253-
}
247+
{id: employee.id,
248+
data: {
249+
id: employee.id,
250+
type: "employees",
251+
attributes: {first_name: "Jane"}
252+
}}
254253
}
255254

256-
257255
it "fires hooks in order" do
258256
expect {
259257
put :update, params: payload

spec/support/rails/employee_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def create
1515

1616
def update
1717
employee = resource.find(params)
18-
18+
1919
if employee.update_attributes
2020
render jsonapi: employee
2121
else

0 commit comments

Comments
 (0)