Errors are not being added

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)

Any ideas?

Jordan Arentsen wrote:

Any ideas?

Richard W. wrote:

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


Rails mailing list
[email protected]
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?

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


Rails mailing list
[email protected]
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”)

Richard W. wrote:

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


Rails mailing list
[email protected]
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.

bump

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?