Git Product home page Git Product logo

grape-jbuilder's People

Contributors

milkcocoa avatar pat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

grape-jbuilder's Issues

Cannot use url helpers

appointments.jbuilder:

json.link root_url

{"error":"undefined local variable or method root_url' for #Grape::Endpoint:0x007ff5640423b8"}`

Jbuilder expected file extensions

The default file extension is .json.jbuilder but this gem is expecting to be used .jbuilder.

When using partials though, you have to use .json.jbuilder.
So, your folder will look like this:

app/views/api/
├── _appointment.json.jbuilder
└── appointments.jbuilder

Routes using namespace are weird

resource :appointments do
  get nil, jbuilder: 'appointments' do
end

This is how one needs to write the routes in order for it to be the same as:

get do
end

View paths inconsistent for view/controller RSpec tests

Take a simple template views/api/posts.jbuilder:

json.posts do
  json.array! @posts do |post|
    json.partial! 'post', post: post
  end
end

And a structure like this:

views/
- api/
  - _post.jbuilder
  - posts.jbuilder

I get the following error in my views specs:

ActionView::Template::Error:
  Missing partial /_post, views/api/_post ... Searched in:
    * "/path/to/app/views"

But my controller specs render everything correctly without raising the template error. Seems like an error to have the second potential lookup start with the views namespace.

Not sure if this is grape, jbuilder, or grape-jbuilder, just assumed it was this library because it seems like you are setting up the render paths.

Or is this something I did?

Json.partial! doesn't work

json.array! Item.all, partial: 'item', as: :item throws exception TypeError: {:partial=>"item", :as=>:item} is not a symbol

ruby 2.1.2
rails 4.1.6

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.