Ruby on rails /setups/new处的语法错误:语法错误,意外的tIDENTIFIER,应为关键字\u end

Ruby on rails /setups/new处的语法错误:语法错误,意外的tIDENTIFIER,应为关键字\u end,ruby-on-rails,Ruby On Rails,我的控制器: class SetupsController < ApplicationController def new @setup = Setup.new @todays_rate = @setup.todays_rates.build end def create @setup = Setup.new(params[:setup]) if @setup.save redirect_to setup_path(@setup

我的控制器

class SetupsController < ApplicationController

  def new
    @setup = Setup.new
    @todays_rate = @setup.todays_rates.build
  end


  def create
    @setup = Setup.new(params[:setup])
    if @setup.save
      redirect_to setup_path(@setup)
    else
      render 'new'
    end
  end

end
class Setup < ActiveRecord::Base
  has_many :todays_rates
  accepts_nested_attributes_for :todays_rates
  attr_accessible :effective_from, :effective_to, :todays_rate
end
类设置控制器
我的视图代码:setup/new.html.erb

<%= form_for @setup, :html => {:multipart => true} do |f| %>
  <% if @setup.errors.any? %>
    <ul>
      <% @setup.errors.full_messages.each do |error| %>
        <li><strong><%= error %></strong></li>
      <% end %>
    </ul>
  <% end %>

  <h4><%= f.label :effective_from, class:'required' %>
    <%= f.text_field :effective_from %></h4>

  <h4><%= f.label :effective_to, class:'required' %>
    <%= f.text_field :effective_to %></h4>


  <%= f.fields_for(:todays_rate) do |i| %>  ##**combining two model with one view**


    <h1>Interest Rate</h1>
    <table cellpadding = "5px" cellspacing = "5px" width = "100%" class="table condensed-table"><tr>
      <h4><th>Days From</th>
        <th>Days To</th>
        <th>Rate</th>
        <th>Senior increment</th>
        <th>Super Senior increment</th>
        <th>Widow increment</th></h4>
    </tr>
      <h4><td><%= i.text_field :days_from, :class => 'input-mini'  %></td></h4>
      <h4> <td><%= i.text_field :days_to, :class => 'input-mini'  %></td></h4>
      <h4><td><%= i.text_field :rate, :class => 'input-mini'  %></td></h4>
      <h4> <td><%= i.text_field :senior_increment, :class => 'input-mini'  %></td></h4>
      <h4> <td><%= i.text_field :super_senior_increment,class:"input-mini"  %></td></h4>
      <h4><td><%= i.text_field :widow_incrtement,class: "input-mini" %></td></h4>
    </table>
  <% end %>
  <fieldset class="form-actions"> <%= f.submit "Create Customer", class: "btn btn-primary" %></field>
{:multipart=>true}do | f |%>
##**将两个模型与一个视图相结合** 利率 从 天到 比率 高级增量 超高级增量 寡妇增量 '输入迷你“%” '输入迷你“%” '输入迷你“%” '输入迷你“%”
setup.rb mmodel

class SetupsController < ApplicationController

  def new
    @setup = Setup.new
    @todays_rate = @setup.todays_rates.build
  end


  def create
    @setup = Setup.new(params[:setup])
    if @setup.save
      redirect_to setup_path(@setup)
    else
      render 'new'
    end
  end

end
class Setup < ActiveRecord::Base
  has_many :todays_rates
  accepts_nested_attributes_for :todays_rates
  attr_accessible :effective_from, :effective_to, :todays_rate
end
类设置

我在一个视图中合并了两个模型,但是我得到了上面的错误。我不知道我在哪里漏掉了关键字_end。有人能帮我吗

我想你的问题是你还没有关闭表单,即你需要在模板末尾加一个


这个错误告诉你,虽然tIDENTIFIER的东西会让你的气味有一点消失。

你在
f.submit
之后在你的
new.html.erb
@Pavan:corrected.但是得到相同的错误相同的错误吗?添加另一个=)事实上,在文章末尾提供日志,而不是在标题中。之后你重启了服务器吗?这一行
应该是这样的
。注意
复数
今天的费率中的变化
@Pavan:谢谢,我更改了行并重新启动了服务器,但它在“/setups/new”中显示“语法错误,意外的tIDENTIFIER,期望关键字结束”错误。还有其他解决方案吗!