Hi All,
I've got an Expense model as follows:
class Expense < ActiveRecord::Base
belongs_to :vendor
def validate_on_create
unless params["expense"]["vendor_id"] != "0" # <= Line 5
errors.add("A vendor must be selected before creating the
expense record")
end
end
end
that crashes with:
undefined local variable or method `params' for #<Expense:0x4716c00>
[snip]
K:/_Projects/Ruby/_Rails_Apps/_EIMS/RTS/app/models/expense.rb:5:in
`validate_on_create'
[snip]
Parameters:
{"commit"=>"Create",
"expense"=>{"vendor_id"=>"0",
Is there some qualification I need to add to get at the parameters?
Thanks in Advance,
Richard
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.