Custom validation with multiple models?

You can use a Proc as argument. Something like this.

Up vote 0 down vote favorite share g+ share fb share tw.

I am finding it hard to do some validation with my custom made validator. Here it is: class SomeValidator options:max record. Errors:baggage {:max => flight.

Max_allowance} end Where flight is the other model, and max_allowance is the number I want to read. This doesn't work of course. Any suggestions?

Ruby-on-rails ruby ruby-on-rails-3 validation activerecord link|improve this question edited May 14 '11 at 11:27 asked May 13 '11 at 23:27shime68711 100% accept rate.

You can use a Proc as argument. Something like this: validates :baggage, :some => {:max => Proc. New{|record| record.flight.

Max_allowance}}.

Now I got this error: comparison of BigDecimal with Proc failed – shime May 14 '11 at 13:14.

Fixed this with: validator class: class SomeValidator record.flight. Max_baggage record. Errors:baggage true end maybe not the smartest way but it works :D thanks for your help fx.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions