Skip to content

Commit

Permalink
Refactor some sample resources
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagopog committed Mar 30, 2017
1 parent 44a4649 commit 98452af
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions spec/support/resources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ class PostResource < ::PostResource; end
class UserResource < JSONAPI::Resource
attributes :first_name, :last_name, :full_name

has_one :profile, class_name: 'Profile', foreign_key_on: :related

has_one :profile, foreign_key_on: :related
has_many :posts

filters :first_name

custom_filters :full_name

def full_name
Expand All @@ -31,5 +29,5 @@ def full_name

class ProfileResource < JSONAPI::Resource
attributes :nickname, :location
has_one :user, class_name: 'User', foreign_key: 'user_id'
has_one :user, class_name: 'User', foreign_key: 'user_id'
end

0 comments on commit 98452af

Please sign in to comment.