Validation problem! please help!

Hi to all,

i’ve the following validation in my model:

class User < ActiveRecord::Base
acts_as_mappable :default_units => :kms,
:default_formula => :flat,
:lat_column_name => :latitudine,
:lng_column_name => :longitudine
has_many :neighborgs
has_many :blacklists
has_many :calls
validates_format_of :mac_address, :with
=>/^([0-9a-fA-F]{2}[:-]){5}[0-9a-fA-F]{2}$/i,
:on => :create,
:on => :update,
:message => "MAC ADDRESS NON CORRETTO, IL FORMATO CORRETTO
E’: 000b8209bcae "

validates_uniqueness_of :mac_address
validates_presence_of :nome, :cognome, :interno, :indirizzo,
:cap, :numero_civico, :telefono_abitazione, :password, :mac_address,
:sncpe
validates_numericality_of :numero_civico, :cap, :interno
validates_format_of :cap, :with => /^[0-9]{5}$/i,
:on => :create,
:on => :update,
:message => “INSERIRE UN CAP VALIDO!!!”

when i insert from the web inferface a wrong value, i’m not redirected
to the web insertion page, but i see on my browser the error “Template
is missing” !!!

I really don’t know what is the problem, because all the validations
work fine!!!

thanks in advance

Andrea

if your validations work fine and you get a template error, then most
likely the error is in the controller code (or the template is missing).
could you post that? and the full error message, so we can see which
template is missing…

could you post that? and the full error message, so we can see which
template is missing…

Yes, i’ve founded the problem…
My mistake, in the controller :slight_smile: !!!

Thanks!!!

On 3 Apr 2008, at 17:16, Andrea C. wrote:

I really don’t know what is the problem, because all the validations
work fine!!!

It’s probably something wrong with your controller, but you haven’t
shown any of that file.

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs