0

I have the follwing at the model:

validates_uniqueness_if :posicao_bastidor, :message => "my message"

When an error occurs, rails gives me the following message:

"Posicao bastidor my message"

I don't want 'Posicao bastidor' to appear. I want just the message.

Some clue on how to do it ?

lcguida
  • 3,787
  • 2
  • 33
  • 56

1 Answers1

1

Try using a leading ^ in the message, like so:

validates_uniqueness_if :posicao_bastidor, :message => "^ my message"
Luís Ramalho
  • 10,018
  • 4
  • 52
  • 67
  • Sorry about that, perhaps would you care and use the following plugin https://github.com/gumayunov/custom-err-msg -- please let me know if it solved your problem. Thank you! – Luís Ramalho Mar 26 '13 at 18:04
  • I couldn't solve the problema myself so I did an workaround. A little more code, but for now it fits (since its only in one place I need that). – lcguida Mar 26 '13 at 18:54