-
Notifications
You must be signed in to change notification settings - Fork 17
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
Chore/remove rails from required libraries #12
Conversation
I see a weird error when sending a hash with an empty array inside as a response — the app catches a |
@spijet Interesting. After digging a bit it appears that a forked version fixed that: cartedo@79049c1 I'll see for updating the PR with adapted testing cover |
Yep, this seems to fix the problem with empty arrays. I also ran into a problem with |
Actually, I was wrong, and my app does use def serializable_class(object)
object = object.first if object.is_a?(Array)
klass = object.model_name.name.split('::').last
format('%<klass>sSerializer', klass: klass).safe_constantize
end It probably won't work for everyone, as it (most likely) relies on auto-loading and auto-resolving magic made possible by Zeitwerk gem, but at least it won't fail on non-namespaced classes. |
A little addition to my take on |
…ctive model and allow passing a custom serializer in the options
```ruby | ||
get "/" do | ||
user = User.find("123") | ||
render user, serializer: 'CustomUserSerializer' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is exactly what I wanted to propose later today! :D Thank you so much!!
I have converted my app to use Grape and |
This PR will close #11
rails
. We're keeping Rails as a development dependency at the moment