-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add support of views or at least "rabl" #44
Comments
I did some work on this |
I tried you branch, but I don't know why it didnt work. always returns |
Did you initialize rabl per its instructions? All my patch does is get tilt in the stack. You'll still need to do RABL.initialize! (or whatever RABL requires, I don't recall) after your bundled gems are loaded, but before you 'run' your api. Give it a shot in config.ru? Also, because the current implementation is pretty naive, you'll need to render by local variables, as detailed in the example. :) |
Rabl need to be resource :me do
get do
template 'user.rabl'
{ :user => current_user }
end
end In the same folder object user
attributes :_id, :display_name Again when I go to |
Hi amrnt, I committed some changes for some simple mistakes I made. I also made an example repository illustrating how this works after my changes. |
progress going awesome! Thanks @onethirtyfive. But there's an issue, (I have 7 items. And I want to object false
child(@object) do
attributes :_id, :caption, :created_at
end
node(:pagination, :unless => @object.blank?) do
{
:next => @object.next_page,
:previous => @object.previous_page,
:total_pages => @object.total_pages,
:current_page => @object.current_page,
}
end returns [
{ }
{ }
{ }
{ }
{ }
{ }
{ }
] Though, it works fine with sinatra/rails |
+1 |
1 similar comment
+1 |
The next release of Grape has cleaner support for other formatters. I made a pull request into grape/rabl using the new syntax here: ruby-grape/grape-rabl#6. This is what the user has to do: formatter :json, Grape::Formatter::Rabl Hope to see a lot more formatters our there! |
No description provided.
The text was updated successfully, but these errors were encountered: