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', :header_message => "Please try
again!", :message => "We need you to change some items in order to
send us a message:" %>
4:      <table>
5:          <tr><td>Name:</td>                                  <td><%= 
f.text_field :name, :size => 30
%></td></tr>
6:          <tr><td>Contact tel:</td>           <td><%= f.text_field :tel, 
:size =>
30 %></td></tr>

    app/views/button/_show_enquiry.html.erb:3
    app/views/button/_show_enquiry.html.erb:2
    app/views/button/enquiry.rjs:1:in
`_run_rjs_app47views47button47enquiry46rjs'
    app/views/button/enquiry.rjs:1:in
`_run_rjs_app47views47button47enquiry46rjs'
    app/controllers/button_controller.rb:24:in `send_mail'
    app/controllers/button_controller.rb:17:in `send_mail'

Here is the partial that is doing the rendering:

<h1>Send us a message</h1>
<% remote_form_for :enquiry, :url => {:action  => 'send_mail'} do |f|
%>
        <%= error_messages_for :enquiry, :header_message => "Please try
again!", :message => "We need you to change some items in order to
send us a message:" %>
        <table>
            <tr><td>Name:</td>                                  <td><%= 
f.text_field :name, :size => 30
%></td></tr>
            <tr><td>Contact tel:</td>           <td><%= f.text_field :tel, 
:size => 30
%></td></tr>
            <tr><td>Email Address:</td> <td><%= f.text_field :email, :size =>
30 %></td></tr>
            <tr><td>Subject:</td>                               <td><%= 
f.text_field :subject, :size =>
30 %></td></tr>
            <tr><td>Message:</td>       <td><%= f.text_area :message, :rows
=> 8, :cols => 30 %></td></tr>
        </table>
        <%= submit_tag("Send") %>
<% end %>

And the partial is invoked by:

page.replace_html 'enquirybox', :partial  => 'show_enquiry', :locals
=> {:enquiry  => @enquiry}

in turn invoked from an ajax request from:

    respond_to  do |format|
      format.js do
        if @enquiry.save
          Emailer.deliver_contact_email(@enquiry)
          flash[:firstname] = @enquiry.firstname
          render :action => 'thank_you'
        else
          render :action => 'enquiry'
        end
      end
      format.html
    end

Anyone have any ideas?

O.


The only difference from the 'norm' is that I am using the custom-err-
msg plugin.

O.

--

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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.


Reply via email to