Skip to content

Allow a custom URL for associations #37

Description

@swilliams

(Inspired by #34)

Right now:

class Hat
  include Arkenstone::Document
  url 'http://example.com/hats'

  has_many :feathers
end

class Feather
end

Will fetch a hat's feathers by calling http://example.com/hats/:id/feathers. Add an option to the association declarations (has_many, belongs_to, etc) to override the associated model name:

class Hat
  include Arkenstone::Document
  url 'http://example.com/hats'

  has_many :feathers, entity_name: 'turtles'
end

Which'll use build this url instead: http://example.com/hats/:id/turtles.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions