Displaying 20 results from an estimated 4000 matches similar to: "get # of errors in error_messages_for"
2010 Aug 18
7
error_messages_for doesn't work
I''m having a problem, ''cause I wrote the following line in my model
"Hi":
[code]
validates_numericality_of :phone, :only_integer => true, :allow_blank =>
false, :message => "must be a number"
[/code]
And in my "new" view, I put:
[code]
<%= error_messages_for :oi,
:header_message => "Erro ao cadastrar
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 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 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
2009 Jun 11
8
before_create return value breaking object.save: rails bug?
I know that usually when people say ''i think i found a bug in
rails/ruby'' they''ve done something dumb. I''m wondering if this is the
case here, but this does seem like a genuine rails bug to me.
In my user model i have a few different before_create callbacks. In one
of them, if it happens to return false (just because the last statement
in it evaluated to
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 Jul 20
7
How do you use :message with validation?
If I do validates_uniqueness_of :name, :message => "It''s not
uniqueeee!!!"
then how do I have it display that message when the check fails?
-Ben Lisbakken
--
Posted via http://www.ruby-forum.com/.
2007 Jul 15
0
errors_for
Been playing with merb.
One of the helpers I liked in rails was on form validations. Found
this was real easy to port over, so I thought I''d share.
It doesn''t highlight the field with the error, but it gives that same
nice little div on top.
Say I had an articles controller
def create
@article = Article.new(params[:article])
@article.save!
redirect
2009 Apr 22
4
help with exceptions
Hello,
I was trying to to write a simple ruby program for exceptions.
My code is:
class ABC
begin
alpha = ABC.new
alpha.foo= [1,2,3]
puts foo.inspect.to_s
NonExisting
raise "all other exceptions"
rescue Exception => NoMethodError
puts ''Hello''
puts $ERROR_INFO.inspect
rescue Exception => NameError
puts ''goodbye''
puts $ERROR_INFO.inspect
else
2009 Mar 28
10
Use fixtures within fixtures?
Heya,
I''m using globalize2 and have following problem with my fixtures:
categories.yml:
one:
parent_id: two
color: #ff00aa
two:
color: #00ff11
three:
parent_id: two
color: #ab00ab
category_translations.yml
one-en:
id: one
locale: en
name: Cars
one-es:
id: one
locale: es
name: Coches
two-en:
id: two
locale: en
name: Start
two-es:
id: two
locale: es
2007 Jun 10
2
custom errors for validates_presence, etc..
I am trying to figure out how to customize the error messages when I use
validates_presence_of. I am validating a user name and I use <%=
error_messages_for ''user'' %> in my view to display the messages. I know
you can customize in the model with :message =>''custom message'', but I
am trying to get rid of the first part of the error message which is,
1
2009 Apr 24
2
plugin loading
I just updated from Rails 1.2.0 to Rails 2.3.2 and none of the app
plugins seem to load. The server starts without any problems, but none
of the plugin code is available. Help!
--
Posted via http://www.ruby-forum.com/.
2009 Nov 10
6
Master/detail report with Rails and Ireport/JasperReports
Hi all,
has anyone made it already?
--
Posted via http://www.ruby-forum.com/.
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
2007 Oct 03
3
Why does error_messages_for take string as param?
Hi,
I wonder why error_messages_for take strings as params instead of
instance variables.
error_messages_for ''user''
instead of
error_messages_for @user
''user'' is translated into @user eventually.
If so, who not take the instance variables directly?
Is there any reason for that?
Thanks in advance.
Sam
--
Posted via http://www.ruby-forum.com/.
2008 Jan 01
2
Easiest defense against SQL injection in object creation?
I''ve been scouring the web for suggested Rails defenses against SQL
injection, but I haven''t found much on the object creation part.
Certainly using attr_protected, etc., is a good way to prevent unwanted
fields from being modified on the new object (if you''re passing a hash
as creation parameters), but what about escaping the POSTed info before
saving? Couldn''t
2009 Jan 05
3
Plugin not found: ["acts_as_list"]
I am trying to install acts_as_list in a rails 2.2.2 project but when I
try the following: ruby script/plugin install acts_as_list
I get: Plugin not found: ["acts_as_list"]
I had to download the acts_as_list plugin from the github because it
isn''t included in Rails 2.2.2.
The files are in my vendor/plugins/acts_as_list folder so I have:
lib/active_record/acts/list.rb
2009 May 25
4
after_create and has_one association bug?
Hello,
I''ve come across an issue that I''m sure is a bug when using after_create
with a has_one association, but I''m not 100% certain if I''m missing
something.
This is pretty much exactly the code I''m using. Two simple classes
(Account and Contact) and I create the contact after I create an account
(via after_create). I''m not passing in a
2008 Oct 08
5
schema.dump chokes on RAW type
I haven''t seen anyone mention this yet.
The tail end of the migration process is a call to schema.dump. Our
primary keys are uuids and these choke schema.dump on both oracle and
postgres. The latter fails silently (skips three tables) while the
former complains about the RAW(16) in each of the three tables.
Anyone had a similar experience?
--
Posted via http://www.ruby-forum.com/.
2009 Aug 16
4
How show validation errors in form_remote_tag?
I suspect this has been asked 400 times, but Google yields 2-3 rather
complex gymnastics in blogs (and possibly dated), and searching list
archives on ruby-forum proves kinda useless.
Using standard forms, it''s fairly easy to use
@object.errors[:field_name] in the form to embed an error message right
next to the field that has the invalid entry. The controller uses a
simple conditional