similar to: error_messages_for doesn't work

Displaying 20 results from an estimated 4000 matches similar to: "error_messages_for doesn't work"

2009 Feb 05
6
get # of errors in error_messages_for
hi everyone here i go again, i have problem we error message validation here is the sample of my code: error_messages_for :user, :header_message => ''X errors, please find red mark'', :message => ''Following errors were found:'' the problem is that how where going to get the value "X errors" or the number of errors if they have when the is
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'',
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 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
2008 Jul 21
6
form_for and select ( => f.select)
Hi All I''m trying to combine the from_for and select helpers Right now I have form_for :service, :url => ...... do |f| select("abc", "xyz_id", @my_arr.collect {|item| [ item, "bla" ] }, {:prompt => "opt1"} ) .... end What I want to do is something like .... f.select("abc", "xyz_id", @my_arr.collect {|item|
2007 Nov 20
3
How to test views with Nested Resources and Partials
Hi everyone, I am relatively new to rspec and I am running into a wall in testing my views. I have a RESTful resource Contracts with a nested resource of Line_items. I am trying to figure out how to test the "edit" form of the Line_items. What complicates this is the nested routing and how to account for it, and that there is a partial form (_form.haml) that both the edit.haml and
2007 Jul 06
3
stubbing helper methods for View specs
Hi there I have several view specs, that include the following snippet in their "before" block to stub the methods by acts_as_authenticated before :each do @u = mock_model(User) @u.should_receive(:name).and_return("Hans Muster") template.should_receive(:logged_in?).and_return(true) template.should_receive(:current_user).and_return(@u) end this
2006 May 31
1
ActiveRecord: When / where to validate data? Tricky question
First of all, thanks for you time. I have kind of a tricky question and wanted to see what you guys thought. ------------------------------------------- Lets say I have this: ------------------------------------------- class Purchase < ActiveRecord::Base validates_numericality_of :some_number, :only_integer => true end ------------------------------------------- Then I do this:
2010 Feb 10
6
validation problems
Hi, there. I have two validations in the model: validates_numericality_of :value, :only_integer=>true, :allow_blank=>true validates_size_of :value, :is=>9, :message=>"must be 5-digit number", :if=>Proc.new{|u| u.value.is_a?(Numeric)} They work as expected except when the :value is character/string like "a" "abc", the second validation will also output
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 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 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 Feb 13
2
Overriding the error_messages_for method
If I wanted to override the error_messages_for method where within the rails structure would I put it? Which file? Thanks :-) John Kopanas http://www.kopanas.com ===================================================================== http://www.soen.info - source of the freshest software engineering information on the net http://cusec.soen.info - software engineering conference
2006 Jun 20
2
Validation error_messages_for problem
I am having trouble getting error_messages_for to work. My controller(relevant parts) looks like def configure @account = session[:account] @user = User.new end def add_new_user_to_account @user = User.new(params[:user]) if @user.valid? session[:account].users << @user end redirect_to :action=> ''configure'' end end and my
2007 Mar 21
4
How to spec error_messages_for
Hi I''m trying to spec a call to error_messages_for to avoid stubbing out whole models. Something like this: context "A rendered calculate_quote view" do setup do @form = mock("form") assigns[:form] = @form end specify "should render the error messages" do <SOMETHING>.should_receive(:error_messages_for).with
2006 May 03
1
error_messages_for when saving within another model
Hi, I have this save routine: def customer_address_create customer_options @customer = Customer.find(params[:id]) @customer.addresses.create(params[:address]) @saved = @customer.save end That passes to a rjs template like this: if @saved page.visual_effect :Fold, ''add_address'' page.replace_html ''addresses'', :partial =>
2006 Jul 17
2
error_messages_for ?
Hi, I can''t list error_messages in my Form ??, and all the formfields are reset ...(I think my redirect :back clean everything, formfield and error_messages ...), only my flash[:notice] is ok.... I would like to use the "error_messages_for" tag to add a simple red * on my textfiled if a problem occurs ... thanks for help arnaud here are the basics steps to check that
2006 Nov 30
3
model stubs with view/controller specs: error_messages_for??
How would I set up a model stub so that <%= error_messages_for ''some_model'' %> doesn''t complain? I started going down this road: @some_model.stub! (:errors).and_return(ActiveRecord::Errors.new) but it seems like a long, hopefully uneccessary road. Cheers, Michael
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/.
2006 Feb 15
6
error_messages_for trouble
I am trying so learn how to do custom validations. The validation works as expected, but I can''t get "error_messages_for" to display. How is the name of the object supposed to be formated? Where is this object created, the model or controller? What am I doing wrong here? #### Model ######################## class MyFolder < ActiveRecord::Base def validate # validation