similar to: custom errors for validates_presence, etc..

Displaying 20 results from an estimated 10000 matches similar to: "custom errors for validates_presence, etc.."

2006 Aug 07
1
Override flash message - help
How can I modify the flash message that is displayed on a validates_* check? I used the :message => "" parameter, but it still gives me an annoying "Test : Please ensure you have entered the test message". I wanted to get rid of the "Test: " and the above "6 errors prohibited this table from being saved" I looked at the source of
2006 Jun 13
7
help with ''error_messages_for''
Greetings, I''m in the throws of deploying an app on site5, and I''m getting strange errors. I think I might need to understand how error_messages_for works. I get a pretty standard looking error: " You have a nil object when you didn''t expect it! You might have expected an instance of ActiveRecord::Base. The error occured while evaluating nil.errors Extracted
2006 Dec 12
2
Error message translation
I have a problem with translation of english phrase when an input error occurs. When I put: error_messages_for("registratie") above my view. I get the error: "xx errors prohibited this registratie from being saved". The problem now is, the site is for dutch customers and I would like to translate this to a dutch phrase. I know I can translate the individual fields with the
2008 Jan 31
3
presenting validation errors via fbml?
Hi Facebookers, Is there a helper or suggested approach for presenting validation errors on an fbml form? Something to translate rails error markup to fbml:error markup? thanks Joel
2006 Jan 27
17
Multiple Model Validation
Hey All ! I have a form which contains two models. I would like both models to be validated, but have their validations aggregated on the page. If I do: <%= error_messages_for(:model1) %> <%= error_messages_for(:model2) %> It puts two big validation blocks on the page. I would like all the errors from both models, but only in one validation box. Is this possible ? All my attempts
2005 Jan 17
5
how to override rails errors messages?
hi, how can i override rails errors mesages (that are in english) to display them in an other language? thanks hangon
2007 Dec 05
5
Active Record, Migration, and Translation
Hi, I think the columns and table in migration should be able to have an optional "display_name" set manually. Something like: create_table :people, {display_name => "Personne"} do |t| t.column :first_name :string, :display_name => "Prénom". end Let me explain my point of view: Rails is a framework made to write programs in English. You see it when you
2006 Mar 14
5
Unable to display errors for multiple records
Hi, I''m trying to save multiple records of the same model in one go. Which is no problem at all. Problem starts when I want to introduce error handling. The problem is that no record should be saved when one of the records contains an error. I tried it as follows: session[:infos].each do |info| @quest.name = info["name"] unless @quest.valid? @errors_found = true
2009 Nov 26
9
ActionView::TemplateError (can't convert ActiveRecord::Error into String)
I cannot work out why this error is appearing. ActionView::TemplateError (can''t convert ActiveRecord::Error into String) on line #3 of app/views/button/_show_enquiry.html.erb: 1: <h1>Send us a message</h1> 2: <% remote_form_for :enquiry, :url => {:action => ''send_mail''} do | f| %> 3: <%= error_messages_for ''enquiry'',
2008 Feb 27
8
ActiveRecord validation messages not I18N-friendly and enforces grammar
ActiveRecord validation messages are currently not I18N-friendly. Specifically, I''m referring to the fact that it enforces a certain grammar, namely the beginning of the message must consist of the field name. For example: validates_presence_of :name, :message => "can''t be blank." ...generates the message "Name can''t be blank". This grammar
2006 Jun 08
5
Field names in validators
Hi! Is there a (simple) way to use alternative field names in validation messages? For example, if I have a validator like this one: validates_presence_of :email how can I make it print a message like "E-Mail Address can''t be blank" instead of "Email can''t be blank"? I can override the "can''t be blank" part by using the :message
2006 Aug 09
6
How to change the error message easy way
validates_presence_of :fname results in the error message "Fname can''t be blank". What I want is "First Name can''t be blank". I could do this def validate errors.add_to_base("First Name can''t be blank") if fname.blank? end I find this clunky and I have to put everyrhing in the validate method. Is there an easy to get what I want. I
2006 Sep 12
2
accessing validates_... , :message => 'something'
Hi, i have a validates_something_of_something method in my User model...i added a :message => "you need to abcd" to the validation method, but when i try to access it through the <%= error_messages_for "user" %> it doesn''t give me any output... i was wondering whether there was a way to access all of the (:message => string) methods that are collected
2010 Feb 03
4
customizing validation msg
Hi, i am using the default validation of RoR how i will customize them i dont want to display the default message but i want to print the message i want like for city_id the default message is "City can''t be blank" i want this message as "Please enter city" Regards -- You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2006 Mar 27
3
Validation - How to pop up error messages
Hi, I''m trying to "validate" the input provided in the login form to see if "username" is entered or not? How do i do this ? In the model i have done like this validates_presence_of username, :body, :message => "Missing required field" But I''m not this message (Missing required field ) getting printed at all? How do i print this? Do i need
2006 Jul 24
6
error_messages_for not working
I have the following code and I am not able to get it working. The error message is not coming on the top, it is just getting displayed on a different page if I dont have the rescue block commented at the bottom. Model: user.rb require "digest/sha1" class User < ActiveRecord::Base validates_presence_of :eaddress, :fname, :passwd, :pcode, :country, :day, :year, :month, :gender,
2008 Sep 01
3
basics questions on rails
Hello, I started to use rails few weeks ago, and I have got basic question about it. 1. There is a way to keep my form filled, after submit it (for example if I get errors) ? 2. I would like to create a ''tree'' with my datas like ''pages'' for example : a page has one children and belongs to a page. I added has_one and belongs_to to the model but it
2008 Jun 02
5
validate - message in the flash[:error]
Hi, I want to show the validate - message in the flash[:error] - field but I can''t find any options. An example: class UserPermission < ActiveRecord::Base validates_presence_of :name, :message => "Please insert a name" ... | end V flash[:error] = "Error - " Has anybody a solution for this
2006 Mar 20
5
Wrap error_messages_for() call when no instance var present
I am trying to put some smarts around a call to <%= error_messages_for %> so that when I first come into this page i.e. when my instance variable @target_list has not been defined yet, the page doesn''t break. I''m doing this: <% if @target_list? %> <%= error_messages_for ''target_list'' %> <% end %> I get a syntax error on line 1.
2006 Mar 26
1
How to override generated in validation html code?
Hi, I would like to ask how to override validation functionality in RoR? In active_record_helper.rb class there is "hardcoded" default html generated durning validation. If I will use {code:ruby} validates_presence_of :summary, :description {code} in my model class, there is html generated: {code:html} <div class="errorExplanation"