Skip to content
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

Sinatra example #57

Closed
andrew opened this issue Jul 4, 2011 · 8 comments
Closed

Sinatra example #57

andrew opened this issue Jul 4, 2011 · 8 comments

Comments

@andrew
Copy link

andrew commented Jul 4, 2011

I can't seem to get rabl to work with sinatra, can you provide an example, perhaps in the wiki?

@nesquena
Copy link
Owner

nesquena commented Jul 4, 2011

What issues are you running into? Require rabl in the gemfile and then do:

get "/" do
  render :rabl, :foo
end

should work. I agree though having it in the wiki is a good idea.

@andrew
Copy link
Author

andrew commented Jul 5, 2011

I'm getting an exception:

NoMethodError - undefined method `present?' for "collection @experiments\nattributes :name":String:
 /Users/andrew/.rvm/gems/ruby-1.8.7-p334/gems/rabl-0.3.0/lib/rabl/engine.rb:26:in `render'
 /Users/andrew/.rvm/gems/ruby-1.8.7-p334/gems/rabl-0.3.0/lib/rabl/template.rb:15:in `evaluate'
 /Users/andrew/.rvm/gems/ruby-1.8.7-p334/gems/tilt-1.3.2/lib/tilt/template.rb:76:in `render'
 /Users/andrew/.rvm/gems/ruby-1.8.7-p334/gems/sinatra-1.2.6/lib/sinatra/base.rb:563:in `render'

@rkh
Copy link

rkh commented Jul 5, 2011

Seems like Rabl doesn't properly depend on ActiveSupport.

@nesquena
Copy link
Owner

nesquena commented Jul 5, 2011

Ah yes that is correct. I was using RABL with AR or DM (and Padrino or Rails) so ActiveSupport was already included. I will add active_support proper to the gemspec, or evaluate if I can remove it from core use and only require it for inflection handling.

@nesquena
Copy link
Owner

nesquena commented Jul 5, 2011

Will put up an example for setting up in a sinatra app on the wiki soon. Should help clear this up.

@nesquena
Copy link
Owner

nesquena commented Jul 6, 2011

Added Sinatra example here (working for me): https://github.com/nesquena/rabl/wiki/Setup-for-Sinatra

@nesquena nesquena closed this as completed Jul 6, 2011
@andrew
Copy link
Author

andrew commented Jul 6, 2011

Awesome, thanks.

@bshanks
Copy link

bshanks commented Nov 19, 2011

perhaps the documentation at https://github.com/nesquena/rabl could be modified to refer to https://github.com/nesquena/rabl/wiki/Setup-for-Sinatra ? Following https://github.com/nesquena/rabl, I had tried to do something like

render "posts/index"

which i guess is appropriate for Padrino but not Sinatra.

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants