ccocchi / rabl-rails

Rails 4.2+ templating system with JSON, XML and Plist support.
MIT License
209 stars 51 forks source link

Unable to access view helpers outside of node #29

Closed john-bai closed 11 years ago

john-bai commented 11 years ago

I'm unable to access view helpers in my rabl templates outside of a node block. This would be nice to conditionally include nodes to a json representation.

#index.json.rabl
collection @user_events

if user_signed_in?
  node :hello do
    "world"
  end
end
undefined method `user_signed_in?' for #<RablRails::Compiler:0x00000104564f28>
john-bai commented 11 years ago

Closing as this could be achieved passing a condition to the node method (though I have yet to see it work)