Rails Instance Variables In Your Views/Partials

Posted by Weston Ganger on July 04, 2014

This can come in real handy when using shared partials such as a sidebar. Just place this in your view/partial

<% @posts ||= Post.all %>

Posted in Rails and Tagged with rails partials 

Need help on your next project or application?

I specialize in Ruby-on-Rails, AngularJS, Javascript, Bootstrap, and Hybrid Mobile Apps with Cordova & Ionic.

Contact Me

Recommended Posts