Rails: before_filter

In your controller, you can have as many as you need, they get executed in the order they are set. Note how in the example below we are also storing something from the last post before the controller action runs: class SearchesController < ApplicationController before_filter :only => :create do |controller| session[:last_search] = controller.params[:search][:query] end before_filter […]