On Sun, Aug 8, 2010 at 4:18 PM, RichardOnRails
wrote:
> 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
?? At that point your instance of Expense should
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 c
Hello Guys
i want to use external validation i mean javascript validation but
whenever click on create i mean (add new record submit)that time my
first text box is black then it give me alert but when i click on 'ok'
it redirect to controller and give error not focus on same text box.
--
Posted v
Hello-
I'm trying to do something pretty basic - validate a form field
against a regex. Here's the line of my model that adds the validation:
validates_format_of :zipcode, :with => /\d{5}(-\d{4})?/, :message =>
'is failing the regex'
When I enter the value "12345" into the form field, it comes
I'm having issues with the validation process. Some of it works fine and
others don't and I do not know why. in this case the last 3 validations
below do not work at all. I'm I doing something wrong? this should be
pretty straight forward, so I thought.
validates_presence_of :login, :email
v
5 matches
Mail list logo