jlong / serve

Serve is a small Rack-based web server and rapid prototyping framework for Web applications (specifically Rails apps). Serve is meant to be a lightweight version of the Views part of the Rails MVC. This makes Serve an ideal framework for prototyping Rails applications or creating simple websites. Serve has full support for Rails-style partials and layouts.
http://get-serve.com
Other
836 stars 90 forks source link

Make content_for rails compatible #47

Closed brentkirby closed 13 years ago

brentkirby commented 13 years ago

I was trying to use some simple rails helpers in a serve project and came across this one. In rails content_for can also retrieve the content if no content is passed (there is no block), you can also set content_for using the content param instead of a block. This changes serve's content_for to mimic that behavior.

content_for(:something, 'some string')
content_for(:something) #=> 'some string'

I couldn't find a spec for testing the helpers, but i can add one for this change if you can point it out. Works fine in the project(s) I'm working on though.

ps, awesome work on serve!

jlong commented 13 years ago

Great stuff! Thank you!

If you'd like to add some code that demos this in the test_project that would be great, too. :)