# Noob question : action controller exception

**URL:** <https://www.ruby-forum.com/t/noob-question-action-controller-exception/183428>\
**Category:** Rails\
**Created:** [February 13, 2010, 7:14pm UTC](https://www.ruby-forum.com/t/noob-question-action-controller-exception/183428 "2010-02-13T19:14:19Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![radu\_puspana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c2a13f/32.png) [@radu\_puspana](https://www.ruby-forum.com/u/radu_puspana)\
**Post date:** [February 13, 2010, 7:14pm UTC](https://www.ruby-forum.com/t/noob-question-action-controller-exception/183428/1 "2010-02-13T19:14:19Z")

</div>

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:

#### All fields marked with \* are required
  
8:  
9: \<% form\_for :order, :url =\> { :action =\> :save\_order } do |  
form| %\>  
10: \<%= form.error\_messages %\>  
11:   
12:   
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 %\>

#### Total worth of your books is \<%= currency\_euro(@cart.total\_price\_of\_products) %\>
  
  

  
\<%= form.label :name, "\*Name " %\>  
\<%= form.text\_field :name, :size =\> 30 %\>  

  

  
\<%= form.label :surmane, "\*Surname " %\>  
\<%= form.text\_field :surname, :size =\> 30 %\>  

  

  
\<%= form.label :adress, "\*Adress " %\>  
\<%= form.text\_area :adress, :rows =\> 4, :cols =\> 35 %\>  

  

  
\<%= form.label :telephone, "\*Telephone " %\>  
\<%= form.text\_field :telephone, :size =\> 30 %\>  

  

  
\<%= form.label :email, “\*Email " %\>  
\<%= form.text\_field :email, :size =\> 30 %\>  

  

  
\<%= form.label :pay\_type,”\*Pay type " %\>  
\<%= form.select :pay\_type,Order::PAYMENT\_TYPES,:prompt  
=\> “Select a payment method” %\>  

  
\<%= submit\_tag “Place order”, :name =\> nil, :class =\>  
“submit” %\>  
  
\<% end %\>

so my question is…what is the message saying, and how should i fix  
this problem??

a billion thx in advance,  
radu

---

<div class="post-metadata">

**Author:** ![radu\_puspana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c2a13f/32.png) [@radu\_puspana](https://www.ruby-forum.com/u/radu_puspana)\
**Post date:** [February 13, 2010, 7:17pm UTC](https://www.ruby-forum.com/t/noob-question-action-controller-exception/183428/2 "2010-02-13T19:17:15Z")

</div>

On 13 February 2010 18:12, radu puspana [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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”?

---

<div class="post-metadata">

**Author:** ![radu\_puspana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c2a13f/32.png) [@radu\_puspana](https://www.ruby-forum.com/u/radu_puspana)\
**Post date:** [February 13, 2010, 7:23pm UTC](https://www.ruby-forum.com/t/noob-question-action-controller-exception/183428/3 "2010-02-13T19:23:06Z")

</div>

On Feb 13, 8:15 pm, Michael P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On 13 February 2010 18:12, radu puspana [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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

---

<div class="post-metadata">

**Author:** ![radu\_puspana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c2a13f/32.png) [@radu\_puspana](https://www.ruby-forum.com/u/radu_puspana)\
**Post date:** [February 13, 2010, 7:52pm UTC](https://www.ruby-forum.com/t/noob-question-action-controller-exception/183428/4 "2010-02-13T19:52:57Z")

</div>

On Sat, 2010-02-13 at 10:12 -0800, radu puspana wrote:

> # Extracted source (around line #10): !!i get this error when i try to submit an empty form or any data !! redirect\_to :action =\> ‘show\_order\_details’ \<%= form.text\_field :telephone, :size =\> 30 %\> \<%= submit\_tag “Place order”, :name =\> nil, :class =\> “submit” %\> \<% 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.

---

<div class="post-metadata">

**Author:** ![radu\_puspana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c2a13f/32.png) [@radu\_puspana](https://www.ruby-forum.com/u/radu_puspana)\
**Post date:** [February 13, 2010, 7:37pm UTC](https://www.ruby-forum.com/t/noob-question-action-controller-exception/183428/5 "2010-02-13T19:37:44Z")

</div>

On 13 February 2010 18:21, radu puspana [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 1. 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

---

<div class="post-metadata">

**Author:** ![radu\_puspana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c2a13f/32.png) [@radu\_puspana](https://www.ruby-forum.com/u/radu_puspana)\
**Post date:** [February 13, 2010, 8:27pm UTC](https://www.ruby-forum.com/t/noob-question-action-controller-exception/183428/6 "2010-02-13T20:27:29Z")

</div>

On Feb 13, 8:51 pm, Craig W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > ```
> > flash[:notice]="Order placed successfully! "
> > <%= form.error_messages %>
> > <%= form.text_field :name, :size => 30 %>
> > <%= form.label :telephone, "*Telephone " %>
> > </div>
> > 
> > ```
> 
> * * *
> 
> try adding (to OrdersController)…
> 
> ```
> else
> 
> ```
> 
> → flash[:notice] = @order.errors.full\_messages.join(" ")  
> render :action =\> ‘checkout’  
> end
> 
> Craig

didn’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

---

<div class="post-metadata">

**Author:** ![radu\_puspana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c2a13f/32.png) [@radu\_puspana](https://www.ruby-forum.com/u/radu_puspana)\
**Post date:** [July 19, 2010, 11:37pm UTC](https://www.ruby-forum.com/t/noob-question-action-controller-exception/183428/7 "2010-07-19T23:37:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![radu\_puspana](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c2a13f/32.png) [@radu\_puspana](https://www.ruby-forum.com/u/radu_puspana)\
**Post date:** [February 13, 2010, 9:28pm UTC](https://www.ruby-forum.com/t/noob-question-action-controller-exception/183428/8 "2010-02-13T21:28:21Z")

</div>

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
