Errors are not being added


#1

In the following code, I’m trying to add an error ‘:promo’, but this
error doesn’t seem to add when I debug it. Does anyone have any idea why
this isn’t working for me?

@business = Business.new(params[:business])
@business.errors.add(:promo)


#2

Any ideas?


#3

Jordan Arentsen wrote:

Any ideas?


#4

Richard W. wrote:

On Wednesday, May 17, 2006, at 6:35 AM, Jordan Arentsen wrote:


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

Assuming that “:promo” is a field of the @business model try this:

@business.errors.add(:promo, “Your error message”)

So the error added must be a field of the @business model?


#5

On Wednesday, May 17, 2006, at 6:35 AM, Jordan Arentsen wrote:


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

Assuming that “:promo” is a field of the @business model try this:

@business.errors.add(:promo, “Your error message”)


#6

Richard W. wrote:

On Wednesday, May 17, 2006, at 6:35 AM, Jordan Arentsen wrote:


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

Assuming that “:promo” is a field of the @business model try this:

@business.errors.add(:promo, “Your error message”)

I tried this and it didn’t work.


#7

bump


#8

You need to provide some more context. How are you determining that
this doesn’t work? Can you post the complete code for your method,
rather than just two lines?