# JSONAPI Resources (Rails): Relationship names

**URL:** https://discuss.jsonapi.org/t/jsonapi-resources-rails-relationship-names/2237
**Category:** Uncategorized
**Created:** [May 29, 2021, 7:48pm UTC](https://discuss.jsonapi.org/t/jsonapi-resources-rails-relationship-names/2237 "2021-05-29T19:48:46Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![data\_hope](https://avatars.discourse-cdn.com/v4/letter/d/5fc32e/32.png) [@data\_hope](https://discuss.jsonapi.org/u/data_hope)
#### Post date: [May 29, 2021, 7:48pm UTC](https://discuss.jsonapi.org/t/jsonapi-resources-rails-relationship-names/2237/1 "2021-05-29T19:48:46Z")

</div>

I got started following [GitHub - cerebris/peeps: Peeps is a demo app for jsonapi-resources](https://github.com/cerebris/peeps) for writing a backend for an ember app. My trouble kind of starts that I want to use `owner_id` as a foreign-key column to the `User` table and in the resource, I want the relationship to be called `owner` referring to `users`.

```ruby
# app/models/user.rb
class User < ApplicationRecord
  has_many :rentals, foreign_key: :owner_id
end
#app/models/rental.rb
class Rental < ApplicationRecord
    belongs_to :user, foreign_key: :owner_id
end
# app/resources/api/user_resource.rb
class API::UserResource < JSONAPI::Resource
  attributes :user_name, :first_name, :last_name, :email, :is_staff, :is_active, :is_superuser, :last_login, :date_joined
  has_many :rentals
end
# app/resources/api/rental_resource.rb
class API::RentalResource < JSONAPI::Resource
  attributes :title, :description, :city, :category, :image, :bedrooms

  has_one :owner
  filter :user
end

```

I am wondering which parameters I need to add to `has_one :owner` in order to signify that this should link to user resources?
