I've got a set of constraints in my model that work fine. I wanted to
remove leading and trailing blanks in a :symbol entry if it is
otherwise valid. So I added lines 9 & 10, as seen in the model class
below. BTW, I tested those lines in a simple Ruby program (after
declaring params = Hash.new) and theY worked fine for my purposes.
With the addition of lines 9 & 10, Rails reports:
undefined local variable or method `params'
and subsequently identifies line 10 as the offender.
I think I'm supposed to get the pamams from the session object. How
can I do that in Rails 2.0.2?
I'm running Ruby 1.8.6 and Rails 2.0.2 over WinXP-Pro/SP2.
Thanks in advance,
class Portfolio < ActiveRecord::Base
params[:symbol] =~ /^\s*([A-Za-z0-9]*)\s*$/ # Line 10
params[:symbol] = $1 if $1 # Line 11
validates_format_of :symbol, :with => /^[a-zA-Z\d]+$/, :on
:message => "(Character other than letter or digit found, e.g a
validates_length_of :symbol, :maximum=>5, :message=>"exceeds %d