-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow custom route names #8
Comments
This may be the solution to my problem, but is there no way to stop sinja from deciding where to put dashes in controller names (routes)? I have updated my test repo @ https://github.com/jgnagy/test-api (which happily works now thanks to #12 being resolved), but it takes the |
Sinja draws the routes based on the symbol passed to the All that being said, your resource is named class TestKeySerializer
include JSONAPI::Serializer
attribute :name
attribute :created_at
def type
'testkey'
end
end More information is available here. This does create a bit of a problem because the links in the payload must line up with the routes drawn in the Sinja application (or else the consuming application may try to access a URL that doesn't exist on a subsequent request). You can kinda-sorta "customize" the Sinja routes by passing in a different symbol, for example |
Yes, that helped quite a bit for test scenario (I committed my update to reflect that), but unfortunately I think it needs to be done at a deeper level in sinja because it is failing in my application while including a related I am trying to build an app that relies on your library to implement the {json:api} spec, so I don't know if that makes me an early adopter, but I would certainly appreciate this customization being available. I can successfully POST to /apikeys and create a new key, but subsequently listing a user's keys produces unexpected results. Going from dashes to underscores in a consistent manner across libraries and possible languages is difficult, so being able to explicitly dictate the route would be helpful. |
Nothing you've described makes me think you need this feature. Do you have some time to chat with me on Gitter or somewhere else so I can help you work through this use case? |
Enhance the
resource
,has_one
, andhas_many
keywords to take an options hash, which may include a custom route name to be used when drawing namespaces. (See also #9.)The text was updated successfully, but these errors were encountered: