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 

Want me to help develop your next project or application?

Contact Us

Specializing in Ruby-on-Rails, Javascript, Multi-Platform Electron Desktop Apps and Hybrid Cordova Mobile Apps.

Recommended Posts