module ApplicationHelper def user_unauthorized? ... end end class HomeController < ApplicationController def index redirect_to '/foo' if view_context.user_unauthorized? end end
Thursday, August 16, 2012
Share methods between controller and views in Rails
The key is to put methods into ApplicationHelper and call them in the controller
- Add index on PostgreSQL table column for in-built ...
- Upgrade Heroku db to new PostgreSQL Dev addon
- Restarting crashed workers in Heroku
- Configure PostgreSQL full-text search using pg_sea...
- Run delayed jobs on Heroku with queue names
- Transfer domain from a Heroku Zerigo account to an...
- Share methods between controller and views in Rail...
- Passing array of elements as multiple arguments in...
- Multiple heroku apps on different subdomains manag...
- ▼ August (9)
- ► 2011 (29)
- ► 2010 (102)
- ► 2009 (143)