-
Notifications
You must be signed in to change notification settings - Fork 18
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
Json.partial! doesn't work #6
Comments
Running into this same exact problem. This issue from JBuilder may have something to do with it? |
You should update tilt-jbuilder gem to 0.7.0. It is fixed in new version. |
I'm trying json.partial! 'path_to_partial' but I'm getting ArgumentError (file or block required). |
Please, show full stacktrace, |
Hi!
I tried in my console:
and it works. I just can't use json.partial! in my jbuilder file. I am calling it like this
|
I think you should check your template view_path in app and partial name in template. Tilt just cannot find your partial |
I explicitly defined view_path and it worked! json.partial! 'some_dir/partial', view_path: Rails.root.join("app", "views", "api", "v1") I wonder why it's not being picked up automatically? |
The view_path in rails app is Rails.root.join("app", "views") if I am right. |
@ownadi @katpadi @ryanbillingsley Is everything ok? @milkcocoa Can we close this? |
Hello! You can close this now. Thank you!
|
Got it working with: require 'grape/jbuilder'
use Rack::Config do |env|
env['api.tilt.root'] = 'app/views/api/'
end as per README.md. json.partial! 'v1/resources/resource', resource: @resource |
json.array! Item.all, partial: 'item', as: :item
throws exceptionTypeError: {:partial=>"item", :as=>:item} is not a symbol
ruby 2.1.2
rails 4.1.6
The text was updated successfully, but these errors were encountered: