Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module ApplicationHelper
- # In Rails 2 this worked as expected, if the user was admin the block would execute and show up in the view
- # In Rails 3 it renders everything on the page up to here twice.
- def admin &blk
- yield if current_user.admin?
- end
- end
- # View
- <% admin do %>
- <%= "I Like Turtles" %>
- <% end %>
Add Comment
Please, Sign In to add comment