Hi folks, can you spare some time? i could sure use it. This is the error message : ArgumentError in Store#save_order Showing app/views/store/checkout.html.erb where line #10 raised: interning empty string Extracted source (around line #10): 7: <h4>All fields marked with * are required</h4> 8: 9: <% form_for :order, :url => { :action => :save_order } do | form| %> 10: <%= form.error_messages %> 11: <fieldset> 12: <history> 13: !!i get this error when i try to submit an empty form or any data !! this is the save_order, mentioned in the error message def save_order @order = Order.new(params[:order]) if @order.save @cart = find_cart @order.add_line_items_from_cart(@cart) session[:cart] = nil flash[:notice]="Order placed successfully! " redirect_to :action => ''show_order_details'' else render :action => ''checkout'' end end ========================this is the code''s view : <% form_for :order, :url => { :action => :save_order } do |form| %> <%= form.error_messages %> <fieldset> <history> <h4> Total worth of your books is <span style="color:black"><%currency_euro(@cart.total_price_of_products) %></span> </h4> </history> <div> <%= form.label :name, "*Name " %> <%= form.text_field :name, :size => 30 %> </div> <div> <%= form.label :surmane, "*Surname " %> <%= form.text_field :surname, :size => 30 %> </div> <div> <%= form.label :adress, "*Adress " %> <%= form.text_area :adress, :rows => 4, :cols => 35 %> </div> <div> <%= form.label :telephone, "*Telephone " %> <%= form.text_field :telephone, :size => 30 %> </div> <div> <%= form.label :email, "*Email " %> <%= form.text_field :email, :size => 30 %> </div> <div> <%= form.label :pay_type,"*Pay type " %> <%= form.select :pay_type,Order::PAYMENT_TYPES,:prompt => "Select a payment method" %> </div> <%= submit_tag "Place order", :name => nil, :class => "submit" %> </fieldset> <% end %> ========================================== so my question is...what is the message saying, and how should i fix this problem?? a billion thx in advance, radu -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 13 February 2010 18:12, radu puspana <radupuspana-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> interning empty string > > Extracted source (around line #10): > > 10: <%= form.error_messages %>Might be a problem with your validations in the Order model. Are you doing any messing around with "humanized_attribute"? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Feb 13, 8:15 pm, Michael Pavling <pavl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 13 February 2010 18:12, radu puspana <radupusp...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > interning empty string > > > Extracted source (around line #10): > > > 10: <%= form.error_messages %> > > Might be a problem with your validations in the Order model. Are you > doing any messing around with "humanized_attribute"?1.thx for the help :) 2. what the heck is "humanized_attribute" ?? 3. yeah, i''m doing some validation in the Order model, here is the code, regarding validation : PAYMENT_TYPES = [ #Displayed stored in db ["Cash" , "cash"], ["Check" , "check"], ["Credit card" , "credit card"] ] ORDER_STATUS_TYPES = [ #Displayed stored in db ["Not shipped" , "not shipped"], ["Shipped" , "shipped"] ] validates_presence_of :name, :surname, :adress, :telephone, :email, :pay_type validates_format_of :name, :with => /[a-zA-Z]{2,50}/i validates_format_of :surname, :with => /[a-zA-Z]{2,50}/i validates_format_of :adress, :with => /^[a-zA- Z0-9ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïñòóôõöøùúûüýÿ\. \,\-\/\'']+[a-zA- Z0-9ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæçèéêëìíîïñòóôõöøùúûüýÿ\. \,\-\/\'' ]+$/i validates_format_of :telephone, :with => /(?!:\A|\s)(?!(\d{1,6}\s+ \D)|((\d{1,2}\s+){2,2}))(((\+\d{1,3})|(\(\+\d{1,3}\)))\s*)?((\d{1,6})| (\(\d{1,6}\)))\/?(([ -.]?)\d{1,5}){1,5}((\s*(#|x|(ext))\.?\s*)\d{1,5})? (?!:(\Z|\w|\b\s))/i validates_length_of :email, :within => 2..128, :message => "is not in the range of 2..128 characters." validates_uniqueness_of :email, :message => "This email is already taken.Please supply a new one" validates_format_of :email, :with => /\A([\w\.\-\+\_]+)@((?:[-a- z0-9]+\.)+[a-z]{2,})\z/i, :message => "This is not a valid email adress.Please renter email" #validate_with EmailValidator /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z] {2,})$/i validates_inclusion_of :pay_type, :in => PAYMENT_TYPES.map{|disp, value| value} ======================================================================= hope u can make some sense of it :) and help me a billion thx in advance, radu -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 13 February 2010 18:21, radu puspana <radupuspana-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 3. yeah, i''m doing some validation in the Order model, here is the > code, regarding validation :Nothing in there jumps out at me as a definite reason why you got the "interning empty string" error (and of course, I may be barking up the wrong tree). My first check would be to comment out all the validation code and try it - if it still fails, the problem''s elsewhere. But if it goes away (or you get DB errors because the validation passes, but DB constraints get broken) then you at least know it''s in there somewhere. PS Limiting the characters that people can enter in their names is going to cause all sorts of frustrations for users -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sat, 2010-02-13 at 10:12 -0800, radu puspana wrote:> Hi folks, can you spare some time? i could sure use it. > > This is the error message : > > ArgumentError in Store#save_order > > Showing app/views/store/checkout.html.erb where line #10 raised: > > interning empty string > > Extracted source (around line #10): > > 7: <h4>All fields marked with * are required</h4> > 8: > 9: <% form_for :order, :url => { :action => :save_order } do | > form| %> > 10: <%= form.error_messages %> > 11: <fieldset> > 12: <history> > 13: > > !!i get this error when i try to submit an empty form or any data !! > > this is the save_order, mentioned in the error message > def save_order > > @order = Order.new(params[:order]) > if @order.save > @cart = find_cart > @order.add_line_items_from_cart(@cart) > session[:cart] = nil > flash[:notice]="Order placed successfully! " > redirect_to :action => ''show_order_details'' > else > render :action => ''checkout'' > end > > end > ========================> this is the code''s view : > > <% form_for :order, :url => { :action => :save_order } do |form| %> > <%= form.error_messages %> > <fieldset> > <history> > <h4> > Total worth of your books is > <span style="color:black"><%> currency_euro(@cart.total_price_of_products) %></span> > </h4> > </history> > <div> > <%= form.label :name, "*Name " %> > <%= form.text_field :name, :size => 30 %> > </div> > <div> > <%= form.label :surmane, "*Surname " %> > <%= form.text_field :surname, :size => 30 %> > </div> > <div> > <%= form.label :adress, "*Adress " %> > <%= form.text_area :adress, :rows => 4, :cols => 35 %> > </div> > <div> > <%= form.label :telephone, "*Telephone " %> > <%= form.text_field :telephone, :size => 30 %> > </div> > <div> > <%= form.label :email, "*Email " %> > <%= form.text_field :email, :size => 30 %> > </div> > <div> > <%= form.label :pay_type,"*Pay type " %> > <%= form.select :pay_type,Order::PAYMENT_TYPES,:prompt > => "Select a payment method" %> > </div> > <%= submit_tag "Place order", :name => nil, :class => > "submit" %> > </fieldset> > <% end %> > ==========================================> > so my question is...what is the message saying, and how should i fix > this problem?? > > a billion thx in advance,---- try adding (to OrdersController)... else --> flash[:notice] = @order.errors.full_messages.join(" ") render :action => ''checkout'' end Craig -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Feb 13, 8:51 pm, Craig White <craigwh...-BQ75lA0ptkhBDgjK7y7TUQ@public.gmane.org> wrote:> On Sat, 2010-02-13 at 10:12 -0800, radu puspana wrote: > > Hi folks, can you spare some time? i could sure use it. > > > This is the error message : > > > ArgumentError in Store#save_order > > > Showing app/views/store/checkout.html.erb where line #10 raised: > > > interning empty string > > > Extracted source (around line #10): > > > 7: <h4>All fields marked with * are required</h4> > > 8: > > 9: <% form_for :order, :url => { :action => :save_order } do | > > form| %> > > 10: <%= form.error_messages %> > > 11: <fieldset> > > 12: <history> > > 13: > > > !!i get this error when i try to submit an empty form or any data !! > > > this is the save_order, mentioned in the error message > > def save_order > > > @order = Order.new(params[:order]) > > if @order.save > > @cart = find_cart > > -xVfhGlgvRx9goHlPtYpdqQ@public.gmane.org_line_items_from_cart(@cart) > > session[:cart] = nil > > flash[:notice]="Order placed successfully! " > > redirect_to :action => ''show_order_details'' > > else > > render :action => ''checkout'' > > end > > > end > > ========================> > this is the code''s view : > > > <% form_for :order, :url => { :action => :save_order } do |form| %> > > <%= form.error_messages %> > > <fieldset> > > <history> > > <h4> > > Total worth of your books is > > <span style="color:black"><%> > currency_euro(@cart.total_price_of_products) %></span> > > </h4> > > </history> > > <div> > > <%= form.label :name, "*Name " %> > > <%= form.text_field :name, :size => 30 %> > > </div> > > <div> > > <%= form.label :surmane, "*Surname " %> > > <%= form.text_field :surname, :size => 30 %> > > </div> > > <div> > > <%= form.label :adress, "*Adress " %> > > <%= form.text_area :adress, :rows => 4, :cols => 35 %> > > </div> > > <div> > > <%= form.label :telephone, "*Telephone " %> > > <%= form.text_field :telephone, :size => 30 %> > > </div> > > <div> > > <%= form.label :email, "*Email " %> > > <%= form.text_field :email, :size => 30 %> > > </div> > > <div> > > <%= form.label :pay_type,"*Pay type " %> > > <%= form.select :pay_type,Order::PAYMENT_TYPES,:prompt > > => "Select a payment method" %> > > </div> > > <%= submit_tag "Place order", :name => nil, :class => > > "submit" %> > > </fieldset> > > <% end %> > > ==========================================> > > so my question is...what is the message saying, and how should i fix > > this problem?? > > > a billion thx in advance, > > ---- > try adding (to OrdersController)... > > else > --> flash[:notice] = @order.errors.full_messages.join(" ") > render :action => ''checkout'' > end > > Craigdidn''t work, same error, but it doesn''t show around which line, the error is raised, like it used to before having the line flash[:notice] = @order.errors.full_messages.join(" ") any other ideas :) a billion thx for your effort, radu> -- > This message has been scanned for viruses and > dangerous content by MailScanner, and is > believed to be clean.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
hey, found the problem. is this line: validates_length_of :email, :within => 2..128, :message => "is not in the range of 2..128 characters." when i try to submit email with the value 4, an error like in my first post appears. any idea why??? regards, radu On Feb 13, 8:35 pm, Michael Pavling <pavl...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 13 February 2010 18:21, radu puspana <radupusp...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > 3. yeah, i''m doing some validation in the Order model, here is the > > code, regarding validation : > > Nothing in there jumps out at me as a definite reason why you got the > "interning empty string" error (and of course, I may be barking up the > wrong tree). My first check would be to comment out all the validation > code and try it - if it still fails, the problem''s elsewhere. But if > it goes away (or you get DB errors because the validation passes, but > DB constraints get broken) then you at least know it''s in there > somewhere. > > PS Limiting the characters that people can enter in their names is > going to cause all sorts of frustrations for users-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Remove ''.'' at the end of the error message radu puspana wrote:> hey, > > found the problem. > > is this line: validates_length_of :email, :within => 2..128, :message > => "is not in the range of 2..128 characters." > > when i try to submit email with the value 4, an error like in my first > post appears. > > any idea why??? > > regards, > radu-- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.