if action_pack version is 3.0.x then raise NoMethodError: undefined method `first\' for nil:NilClass