ruby on rails - Know if validation was already called -


How do know that a model is already valid?

  U = User.New U.name = "Ralph" u.valid? # = & Gt; Correct u.validated? # = & Gt; False  

I want to stop a lot of questions on geocoding.

If you have before_validation: geocode callback, To cache code results, you can improve your code:

  def geocode @geocode_results || = {} # Suppose geocodeing depends on the `wave_lon` characteristic @gicod_rates [lat_l]] = = # end of your heavy code  

the hash value in the form of caching Returns the GeoCoding when lat_lon changes.


Comments