search for: error_messages_for

Displaying 20 results from an estimated 254 matches for "error_messages_for".

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 source (around line #7): 4: 5: <div class="admin_content_row...
2005 Dec 19
7
Error handling!
...s_presence_of :name" in my comments model. This is the problem I''m facing now. In past examples I''ve looked at, for example when you''ve just scaffolded a page, the page seems to submit back to itself if there''s an error and displays the error using <% error_messages_for ''post'' %> However, the way this seems to be working which is the same method that the "creating a weblog in 15 minutes" video uses, the page will never return to itself and so cannot display the error. It simply says "comment added" and posts not passing...
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 sy...
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=>...
2006 May 03
1
error_messages_for when saving within another model
...er.save end That passes to a rjs template like this: if @saved page.visual_effect :Fold, ''add_address'' page.replace_html ''addresses'', :partial => ''customer_address_list'' else page.replace_html ''address_error'', "#{error_messages_for(''customer'')}" page.visual_effect :Highlight, ''address_error'' page.show ''address_error'' end To handle the error messages. I am unable to get a proper error message however. If i use error_messages_for(''address'') it retu...
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...
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(:e...
2006 Jul 24
6
error_messages_for not working
...ot;> <tr><td class="panelheader">Quick Register!</td></tr> <tr valign="top" align="left"> <td class="loginbg"> <%= form_tag(:controller => "login", :action => "register_user") %> <%= error_messages_for(:user) %> ... Controller: community_controller.rb def register_user # begin @user = User.new(params["user"]) @user.passwd = User.hash_password(params["user"]["passwd"]) if @user.save! redirect_to(:controller => "profile", :action => "createpro...
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.so...
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 password and confirm_password are equal: a form: ----------- <%= form_tag :controller => "contact", :action => "addClient" %&...
2006 Jan 23
2
Problems with error_messages_for
...ach Street already assigned to the Area by using form fields with street[id][name], street[id][num_houses] etc. But when I send the form I don''t know how to get any validation errors reported. Errors on Area are nicely displayed with the red outlines - I think this is thanks to <%= error_messages_for ''area'' %> being included in the view. Can I get this to work for the multiple Street input fields as well? I''ve tried <%= error_messages_for ''street'' %> (You have a nil object when you didn''t expect it! You might have expected an in...
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 test if name == ''test...
2006 Aug 09
1
Clarification on error_messages_for
Just learning Rails.. So this is probably a noob question. My apologies. Could anyone please give me a quick summary/example on the usage of error_messages_for? I have two tables/models, Group and GroupMembers. Obviously, a Group has_many GroupMembers. I have a customized view which shows a list of GroupMembers followed by a field and a button which facilitates adding a member to the group by either email address or login. When the user attempts to ad...
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
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 have failed thus far :) -------------- next part -------------- An HTML attachme...
2006 Jul 13
1
error_messages_for
...eate @Record.new(params[''record'']) if @record.valid? @record.save redirect_to :action => ''show'', :id = @record.product_id else render_action ''new'' end end end view-------------- <%= error_messages_for ''Record'' %> <form action ="../record/create" method = "post"> <input id = "record_product_id" name = "record[product_id]" type="hidden" value ="<% @product.id %>" /> <input id="record_sw&qu...
2010 Aug 18
7
error_messages_for doesn't work
...9;'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 usuário." , :message => "Cheque o(s) seguinte(s) campo(s):"%> [/code] Rails notice the error, because I can''t save a Hi object with phone not being a number; but it doesn'...
2006 Jul 29
0
error_messages_for - Custom formating
Hi all, I am trying to change the default formatting for the error_messages_for. To quote from the ROR manual: /////////// error_messages_for(object_name, options = {}) 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 - Us...
2006 Jun 07
0
problem with error_messages_for
Hi everyone, I have this weird problem where error_messages_for isn''t working. I have a model group which has to validates constraints.. --------------------------------- class Group < ActiveRecord::Base #directionality points to the user model #this table contains the foreign key belongs_to :user validates_uniqueness_of :name validates_prese...
2006 Nov 04
1
error_messages_for ''a''
hi all, i have two models in single form and i want to display error messages for both on submission when i do something like this i get an error <%= error_messages_for ''a'' %> <%= error_messages_for ''b'' %> can anyone tell me how can i do something like this thanks in advance regards gaurav -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/at...