search for: errorexplan

Displaying 20 results from an estimated 22 matches for "errorexplan".

2006 Mar 01
5
scaffold.css and Rails tutorial problem
...: 13px; line-height: 18px; } pre { background-color: #eee; padding: 10px; font-size: 11px; } a { color: #000; } a:visited { color: #666; } a:hover { color: #fff; background-color:#000; } .fieldWithErrors { padding: 2px; background-color: red; display: table; } #ErrorExplanation { width: 400px; border: 2px solid #red; padding: 7px; padding-bottom: 12px; margin-bottom: 20px; background-color: #f0f0f0; } #ErrorExplanation h2 { text-align: left; font-weight: bold; padding: 5px 5px 5px 15px; font-size: 12px; margin: -7px; background-color: #c0...
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
....inject(0) {|sum, object| sum + object.errors.count } unless count.zero? html = {} [:id, :class].each do |key| if options.include?(key) value = options[key] html[key] = value unless value.blank? else html[key] = ''errorExplanation'' end end header_message = "Errors prohibited this #{(options[:object_name] || params.first).to_s.gsub(''_'', '' '')} from being saved" error_messages = objects.map {|object| object.errors.full_messages.map {|m...
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
2006 Jan 22
5
has_one not working as expected?
I messed around with Rails for a while last year, but then got busy and had to drop it. However, I now have time again, so I''m starting to play around with a simple database schema to model my extensive collection of photographic material, including equipment, negatives, photographs, etc. I''m running into an issue with using belongs_to/has_one methods. Read on for an
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
2011 Jan 26
13
undefined method `model_name' for NilClass:Class
...ing c:/Gpsappm/app/views/user_comments/_form.html.erb where line #1 raised: undefined method `model_name'' for NilClass:Class Extracted source (around line #1): 1: <%= form_for(@user_comment) do |user_comments| %> 2: <% if @user_comment.errors.any? %> 3: <div id="errorExplanation"> 4: <h2><%= pluralize(@user_comment.errors.count, "error") %> prohibited this user comment from being saved:</h2> (1) What exactly does this error message mean? From other posts I gather this is a null instance of UserComments, but this is to create...
2006 Jul 19
0
Form helpers produce invalid XHTML code!
...;input name="commit" type="submit" value="Create" /> </form> So far, so good. But as soon as an error is shown after submitting the form it produces this code: <form action="/en/bookings/create" method="post"> <div class="errorExplanation" id="errorExplanation"><h2>1 error prohibited this artist from being saved</h2><p>There were problems with the following fields:</p><ul><li>Name can''t be blank</li></ul></div> <!--[form:artist]--> <p&g...
2006 Jul 29
0
error_messages_for - Custom formating
...{}) Returns a string with a div containing all the error messages for the object located as an instance variable by the name of object_name. This div can be tailored by the following options: header_tag - Used for the header of the error div (default: h2) id - The id of the error div (default: errorExplanation) class - The class of the error div (default: errorExplanation) NOTE: This is a pre-packaged presentation of the errors with embedded strings and a certain HTML structure. If what you need is significantly different from the default presentation, it makes plenty of sense to access the obje...
2006 Mar 26
1
How to override generated in validation html code?
...ride 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" id="errorExplanation"><h2>2 errors prohibited this issue from being saved</h2><p>There were problems with the following fields:</p><ul><li>Summary can''t be blank</li><li>Description can''t be blank</li&gt...
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 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 30
8
Translating a validtion flash
I''m a belgian Rails user (Dutch is my native language). I wondered if it is possible to translate error messages (generated by validators). I know how to create my own error messages: def method content rescue logger.error(...) flash[:notice] = ''My own error message" redirect_to(...) But where can I find the validator''s .rb files, so I can change them?
2006 Jun 16
0
rake spec controller test output hideus.
...ge'');\", 4000);\n// ]]>\n</script>\n\n\n\n\t<div class=\"rowcontainer\">\n<div class=\"halfcolumn\">\n<form action=\"/user/signup\" method=\"post\"><p style=\"text-align:center;\">\n<div class=\"errorExplanation\" id=\"errorExplanation\"><h2>3 errors prohibited this user from being saved</h2><p>There were problems with the following fields:</p><ul><li>Name can''t be blank</li><li>Name is too short (minimum is 4 characters)</l...
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
2010 Mar 24
3
flash error & fade away
this is my current code: #notice { border: solid 1px #99cc99; background-color: #e2f9e3; color: #006600; padding: 5px; margin-bottom: 5px; } #notice.error { border-color: #e2f9e3; background-color: #eeaaaa; color: #cc0000; } <% flash.each do |key, msg| %> <%= content_tag :div, flash[:error] || flash[:notice], :id => ''notice'', :class =>
2005 Dec 16
12
validates_presence_of not working
Hi, I''m new to ruby and rails. I just created a simple update page and the update works fine if all form fields are filled in. However there is one field that should never be allowed to be blank. So I put this in my model: class Topic < ActiveRecord::Base validates_presence_of :dr_title validates_length_of :dr_title, :minimum => 1 So, when I submit the form with a blank
2008 Mar 13
22
Specifing methods in a steps_for block
...uot;there should be $number more $type? in the system" do | number, type| type.classify.constantize.count.should == (@initial_item_count + number.to_i) end Then "there should be an error message explaining what went wrong" do response.should have_tag(''div#errorExplanation'') end Then "the user should see the form again" do response.should have_tag(''form[method=post]'') end end This more or less works for me. However, I''m interested in two things. First, is this good practice? It''s DRY, but I...
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