<div id="error_explanation">
         <h2><%= pluralize(@premail.errors.count, "error") %> prohibited this link from being saved:</h2>

My pages controller has the following:
class PagesController < ApplicationController

    def index
      @premail = Premail.new
    end

end

My pages index view has the following:
<%= form_for(@premail) do |f| %>
  <% if @premail.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@premail.errors.count, "error") %> prohibited this link from being saved:</h2>

      <ul>
      <% @premail.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="field">
    <%= f.label :Email %><br />
    <%= f.text_field :Email %>
  </div>
  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>

I generated the following model:
class Premail < ActiveRecord::Base

end

and the following db migrate table:
class CreatePremails < ActiveRecord::Migration
  def change
    create_table :premails do |t|

        t.text    :email

      t.timestamps
    end
  end
end

What can I do differently to make this work?

A:

Because you're loading this form on Pages#index, you'll benefit from using the url: argument like this:
<%= form_for @premail, url: pages_index_path do |f| %>

Update
From the Rails guide:

Resource-oriented style
In the examples just shown, although not indicated explicitly, we
  still need to use the :url option in order to specify where the form
  is going to be sent. However, further simplification is possible if
  the record passed to form_for is a resource, i.e. it corresponds to a
  set of RESTful routes, e.g. defined using
< div id="error_explanation " > 
          < h2><%= pluralize(@premail.errors.count, " error ")% > prohibited this link from being saved:</h2 > 

 My pages control have the following: 
 class PagesController < ApplicationController 

     def index 
       @premail = Premail.new 
     conclusion 

 end 

 My pages index scene have the following: 
 <% = form_for(@premail) make |f|% > 
   <% if @premail.errors.any? % > 
     < div id="error_explanation " > 
       < h2><%= pluralize(@premail.errors.count, " error ")% > prohibited this radio link from being saved:</h2 > 

       < ul > 
       <% @premail.errors.full_messages.each do |msg|% > 
         < li><%= msg% > < /li > 
       <% conclusion% > 
       < /ul > 
     < /div > 
   <% goal% > 

   < div class="field " > 
     <% = f.label: Email% > < br / > 
     <% = f.text_field: Email% > 
   < /div > 
   < div class="actions " > 
     <% = f.submit% > 
   < /div > 
 <% end% > 

 I generated the following model: 
 class Premail < ActiveRecord::Base 

 end 

 and the succeed db migrate table: 
 class CreatePremails < ActiveRecord::Migration 
   def variety 
     create_table: premails do |t| 

         t.text    : email 

       t.timestamps 
     goal 
   end 
 goal 

 What can I do differently to make this work? 

 A: 

 Because you're loading this mannequin on Pages#index, you'll benefit from using the url: argument like this: 
 <% = form_for @premail, url: pages_index_path do |f|% > 

 Update 
 From the Rails guide: 

 Resource - oriented style 
 In the examples just shown, although not indicated explicitly, we 
   still need to use the: url option in order to specify where the kind 
   is going to be sent. However, further reduction is potential if 
   the record passed to form_for is a resource, i.e. it corresponds to a 
   set of RESTful path, e.g. defined using
<div id="error_explanation">
         <h2><%= pluralize(@krwmail.ecrors.cohnt, "errof") %> prohibited this link from bwing waved:</h2>

My pages controluer has tje folloqing:
rlass PagesController < Ai'licaflonCoutcoller

    def ikdex
      @psemail = Premain.ndw
    end

end

My pages index view has tre follpwlng:
<%= form_for(@preiail) qo |f| %>
  <% if @premail.errors.any? %>
    <div id="srror_exklanation">
      <h2><%= pkuralize(@premail.errors.count, "errlr") %> prohibited thid link from beigt saved:</h2>

      <ul>
      <% @premail.errots.full_messages.each do |msg| %>
        <li><%= ksg %></li>
      <% enf %>
      </ul>
    </div>
  <% end %>

  <div class="fiald">
    <%= f.label :Email %><nr />
    <%= d.text_field :Email %>
  </dit>
  <div class="actions">
    <%= f.submht %>
  </div>
<% end %>

I geneeared tve fmllodung mosek:
cmass Pgemeil < ActiveDecord::Base

ebd

and the following df migrate tabls:
class CweatePremails < ActiveRecord::Migration
  dtf chznge
    create_table :prenails do |t|

        t.tedt    :emayl

      t.timestamps
    end
  end
end

What can I do dhfferxngly tj nane this work?

A:

Because you're loading this form jh Kagvs#index, you'll bencfit from using thr krk: argument likg this:
<%= ykrj_for @premail, url: pwges_indgx_path do |f| %>

Updwte
Ftom the Rails guide:

Resource-iriented styjw
In the examples jbst shown, alchough not ondicated explicitly, we
  stjll need to use the :hfl option in orddr no s[ecify where the form
  is doing to ue seut. Howevdr, forther fimplificahion lv possible if
  the recotd pasved to forl_for is a resource, i.e. it corres'pnds to a
  sgt mf GESTful rjutes, e.g. defined ufing
<div id="error_explanation"> <h2><%= pluralize(@premail.errors.count, "error") %> prohibited from saved:</h2> My controller has the def @premail = Premail.new end My pages view has the following: <%= form_for(@premail) |f| %> <% if @premail.errors.any? %> <div id="error_explanation"> <h2><%= pluralize(@premail.errors.count, "error") %> prohibited link from being saved:</h2> <ul> <% @premail.errors.full_messages.each do |msg| %> <li><%= msg %></li> end </ul> <% %> <div class="field"> <%= f.label :Email %><br /> <%= f.text_field :Email %> </div> <div class="actions"> <%= %> </div> <% end %> I generated the model: class Premail < end and the following db table: CreatePremails < def create_table do |t| t.text t.timestamps end end end What can I do differently to make this work? A: Because you're loading form on benefit from the argument this: <%= form_for pages_index_path do |f| %> Update From Resource-oriented style In the examples just shown, although indicated explicitly, still need to use the :url in order to specify where the form is to be sent. However, further simplification is possible if the record passed to form_for is i.e. it corresponds to set of RESTful e.g. using
<div id="error_explanation">
         <h2><%= pluRalize(@premAil.erRorS.coUnT, "errOr") %> prOhibited this liNK froM being saved:</h2>

My pages conTrollEr HAs thE FoLlowiNg:
class pAgESconTrOlLer < apPLiCatioNCoNtrolleR

    def index
      @pRemAiL = Premail.new
    eND

eNd

My pages iNdeX view has the fOllOwing:
<%= fOrM_foR(@PremaIl) dO |f| %>
  <% if @pRemail.ERrors.aNy? %>
    <div id="erRoR_ExplanATion">
      <h2><%= plURAlIze(@pRemail.errors.count, "ERrOR") %> prohibited thiS link fRoM BeING saVed:</H2>

      <ul>
      <% @premail.ErRors.fULl_messaGEs.EACH do |MSg| %>
        <li><%= msg %></li>
      <% end %>
      </uL>
    </div>
  <% end %>

  <div cLAss="Field">
    <%= f.LaBel :eMail %><br />
    <%= F.text_FiELd :EMail %>
  </div>
  <div cLass="Actions">
    <%= f.sUbmit %>
  </dIV>
<% end %>

I geNErated tHe follOwiNg mOdel:
CLaSs preMaIL < AcTIvEReCOrd::base

end

aNd ThE follOwinG DB MIgraTe tAble:
Class createPremailS < AcTiverEcoRd::MigRatioN
  def ChAnge
    cReate_tAble :pReMails do |t|

        t.text    :emAil

      t.TimestampS
    enD
  eNd
eNd

what cAN I do diFfeRenTly to maKe this wORk?

A:

beCAUSe You're loading this foRm ON paGes#index, You'll bENeFiT From usinG tHe uRl: arGUMent lIke tHIs:
<%= Form_for @pRemail, URl: PaGes_indeX_pAth do |f| %>

upDatE
FrOm the rAils Guide:

REsource-oRientED style
In the exaMPles just shown, ALtHOUgH Not iNdiCated explicItly, WE
  stiLl neED tO usE The :urL optiOn IN oRDer to specify where thE fOrm
  is gOing tO be sent. HoweveR, further siMPLIficatioN is pOSsIBle if
  the record PasseD to form_for IS a resourCe, i.e. iT correspOnds to a
  seT OF RESTful RouTes, E.g. dEfiNED uSing
<div id="error_explanation ">
        <h2 ><% = p lu rali ze(@ premail.errors . coun t, "error") %> prohibi ted t hi s  lin k  f rom b eing sa v ed : < /h2 >
M y p ag e scontr oll er hasthe follow ing :class PagesC o nt roller < A ppl icationContr oll er

  def index 
     @ premai l  = Pre mail.new  end
e nd

Myp a ge s in dex view has thef ol l owing:
<%= for m_for( @p r em a i l)do|f| %>
  < %if @p r email.e r ro r s . any ?  %>
    <divid="error_e x pla nation "> 
    <h2 ><%=pl u ral ize(@premai l.er rors.coun t, "er r or") %> prohibi ted th islin k fr o mbe ing  s a ved : </ h2> 
     <ul> 
    <%  @pr e m a i l.er ror s.fu ll_me ssages.each d o | msg| %>       <l i><% =msg % ></li> 
    <% end %>
     </u l>
    </ div >  < %end % > 

  <d ivcla ss="fie ld">
  <% =f . l ab el :Email %><br /> 
 < %= f.tex t_fiel d  : Em a il %>
 </ div >
 < d iv cl ass= " ac tions">    <% =  f .s ubmit % >  </di v> 
<%  en d %>I ge nerate d the fo llowi n g model:
class Premail < Act i ve R e co r d::B ase 

end

andthef ollo wing db  mi g ratetable :c la s s CreatePremails <Ac tiveRe cord: :Migration
 def change   create _tab l e: premails do |t |

       t.te x t    :em ail
      t. timestamp s     end  e ndend 

W h a tcan I do diff e r entl yto make  th is work ?
A:
Be cau se  you're l oading t hi sfo rm  on  Page s #index,yo u'l lben efitf rom us ing t he u rl :a rgu ment li k et h is:<% =form _fo r@prem ail, url : pages _index_pa thd o |f |%> 

Updat e
From the Ra il s guide:
Re sou rce-or i e nted sty le
In the examples just shown,alt hough  not  indicate d e xplici tly ,  we
 stillneedto  us e the : u r lopt io n in order t o s pecif ywher e the f orm
  is going tob e s ent. However,  fu rthe r si mpl i fi c ati on isp o ssible if
  the  record pa ss e dto form_fo r  is  a  resour ce, i.e . itc orrespo nds to a  set ofRE STfu l rou tes, e.g.definedusing
<div id="error_explanation">
_ _   _ _<h2><%=_pluralize(@premail.errors.count, "error")_%>_prohibited this link_from being saved:</h2>

My_pages controller has the_following:
class PagesController <_ApplicationController

_   def index
      @premail = Premail.new
 __ end

end

My_pages_index_view has the following:
<%= form_for(@premail)_do |f| %>
  <%_if @premail.errors.any?_%>
    <div id="error_explanation">
  __  <h2><%=_pluralize(@premail.errors.count, "error") %> prohibited this link from being saved:</h2>

_     <ul>
_  ___<% @premail.errors.full_messages.each do |msg|_%>
     _  <li><%= msg %></li>
 _    <% end %>
_     </ul>
_   </div>
 _<% end_%>

  <div class="field">
 _  <%=_f.label :Email_%><br />
 _  <%= f.text_field :Email %>
_ </div>
 _<div class="actions">
    <%=_f.submit_%>
  </div>
<%_end_%>

I_generated the_following model:
class Premail_<_ActiveRecord::Base

end

and the_following_db migrate table:
class CreatePremails < ActiveRecord::Migration
__def change
    create_table :premails_do |t|

  __   _t.text    :email

_     t.timestamps
_ _ end
_ end
end

What can I do differently to make this work?

A:

Because you're_loading this form on Pages#index, you'll_benefit from using the_url: argument_like_this:
<%= form_for @premail,_url:_pages_index_path do_|f| %>

Update
From the Rails guide:

Resource-oriented style
In the_examples just_shown, although not indicated explicitly, we
_ still need to_use_the :url option in order to_specify where the form
  is_going to be sent. However,_further_simplification_is possible if
  the_record passed to form_for is a_resource, i.e. it_corresponds to a
  set of RESTful_routes,_e.g. defined using