RE: Application.rb params[]


#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


#2

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


#3

On 1/12/06, removed_email_address@domain.invalid removed_email_address@domain.invalid
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