unknown
1
Spectre013 wrote:
Here is the line
if params[:day]
Spectre013,
I was having a similar problem testing for the existence of a param[] in
my controller. I solved it like this:
if !defined? params[:id] || params[:id].nil
redirect_to :action => ‘list’
else
@foobar = FooBar.find(params[:id])
end
Maybe this helps.
Matt
–
Matt C. Wagner
Information Security Analyst
Network Intrusion Detection
Security Operations Center
Corporate Information Security
Wells Fargo Bank
if !defined? params[:id] || params[:id].nil
redirect_to :action => ‘list’
else
@foobar = FooBar.find(params[:id])
end
This might also work…
…
redirect_to :action => ‘list’ unless params[:id]
@foobar = FooBar.find(params[:id])
…
_Kevin
On 1/12/06, [email protected] [email protected]
wrote:
if !defined? params[:id] || params[:id].nil
redirect_to :action => ‘list’
else
@foobar = FooBar.find(params[:id])
end
Maybe this helps.
Matt
Still throws a nil error when called in the initialize method, thanks
for
the example will keep it in mind as I learn Rails.
Brian