Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Rails 5 ActionController::UrlGenerationError-缺少必需的键:[:id]_Ruby On Rails_Ruby_Ruby On Rails 5 - Fatal编程技术网

Ruby on rails Rails 5 ActionController::UrlGenerationError-缺少必需的键:[:id]

Ruby on rails Rails 5 ActionController::UrlGenerationError-缺少必需的键:[:id],ruby-on-rails,ruby,ruby-on-rails-5,Ruby On Rails,Ruby,Ruby On Rails 5,我正在遵循中的教程,但将产品模型替换为成员,以便我可以将其用于我正在进行的项目。我来自Django,对Rails路非常陌生 当试图通过行项目路径传递成员Id时,我遇到的错误是我的按钮指向助手。除了替换型号名称外,我已逐字输入 我真的不确定我应该在这里放置多少代码而不添加太多。如果您需要更多,请询问 错误错误显示缺少所需的键:[:id],但我无法找到它 查看/contribute/index.html.rb ... <tbody> <%= cache @memberships

我正在遵循中的教程,但将
产品
模型替换为
成员
,以便我可以将其用于我正在进行的项目。我来自Django,对Rails路非常陌生

当试图通过
行项目路径传递
成员Id
时,我遇到的错误是我的
按钮指向
助手。除了替换型号名称外,我已逐字输入

我真的不确定我应该在这里放置多少代码而不添加太多。如果您需要更多,请询问

错误错误显示
缺少所需的键:[:id]
,但我无法找到它

查看/contribute/index.html.rb

...
<tbody>
  <%= cache @memberships do %>
    <% @memberships.each do |membership| %>
        <%= cache membership do %>
        <tr>
          <td><%= image_tag(membership.image_url, class: 'list_image') %></td>
          <td><%= membership.title %></td>
          <td><%= sanitize(membership.description) %></td>
          <td>
            <%= number_to_currency(membership.price) %> <br>
            <%= button_to 'Add to Cart', line_item_path(membership_id: membership) %>
          </td>
        </tr>
        <% end %>
    <% end %>
  <% end %>
</tbody>
...
module CurrentCart

  private

  def set_cart
    @cart = Cart.find(session[:cart_id])
  rescue ActiveRecord::RecordNotFound
    @cart = Cart.create
    session[:cart_id] = @cart.id
  end
end
class Cart < ApplicationRecord
  has_many :line_items, dependent: :destroy
end
class LineItem < ApplicationRecord
  belongs_to :membership
  belongs_to :cart
end
控制器/线路项目控制器

  include CurrentCart
  before_action :set_cart, only: [:create]
  before_action :set_line_item, only: [:show, :edit, :update, :destroy]
  ...
  def create
    membership = Membership.find(params[:membership_id])
    @line_item = @cart.line_items.build(membership)

    respond_to do |format|
      if @line_item.save
        format.html { redirect_to @line_item.cart, notice: 'Line item was successfully created.' }
        format.json { render :show, status: :created, location: @line_item }
      else
        format.html { render :new }
        format.json { render json: @line_item.errors, status: :unprocessable_entity }
      end
    end
  end
  ...
def create
    @cart = Cart.new(cart_params)

    respond_to do |format|
      if @cart.save
        format.html { redirect_to @cart, notice: 'Cart was successfully created.' }
        format.json { render :show, status: :created, location: @cart }
      else
        format.html { render :new }
        format.json { render json: @cart.errors, status: :unprocessable_entity }
      end
    end
  end
控制器/cart\u控制器

  include CurrentCart
  before_action :set_cart, only: [:create]
  before_action :set_line_item, only: [:show, :edit, :update, :destroy]
  ...
  def create
    membership = Membership.find(params[:membership_id])
    @line_item = @cart.line_items.build(membership)

    respond_to do |format|
      if @line_item.save
        format.html { redirect_to @line_item.cart, notice: 'Line item was successfully created.' }
        format.json { render :show, status: :created, location: @line_item }
      else
        format.html { render :new }
        format.json { render json: @line_item.errors, status: :unprocessable_entity }
      end
    end
  end
  ...
def create
    @cart = Cart.new(cart_params)

    respond_to do |format|
      if @cart.save
        format.html { redirect_to @cart, notice: 'Cart was successfully created.' }
        format.json { render :show, status: :created, location: @cart }
      else
        format.html { render :new }
        format.json { render json: @cart.errors, status: :unprocessable_entity }
      end
    end
  end
型号/cart.rb

...
<tbody>
  <%= cache @memberships do %>
    <% @memberships.each do |membership| %>
        <%= cache membership do %>
        <tr>
          <td><%= image_tag(membership.image_url, class: 'list_image') %></td>
          <td><%= membership.title %></td>
          <td><%= sanitize(membership.description) %></td>
          <td>
            <%= number_to_currency(membership.price) %> <br>
            <%= button_to 'Add to Cart', line_item_path(membership_id: membership) %>
          </td>
        </tr>
        <% end %>
    <% end %>
  <% end %>
</tbody>
...
module CurrentCart

  private

  def set_cart
    @cart = Cart.find(session[:cart_id])
  rescue ActiveRecord::RecordNotFound
    @cart = Cart.create
    session[:cart_id] = @cart.id
  end
end
class Cart < ApplicationRecord
  has_many :line_items, dependent: :destroy
end
class LineItem < ApplicationRecord
  belongs_to :membership
  belongs_to :cart
end
class购物车
型号/行项目.rb

...
<tbody>
  <%= cache @memberships do %>
    <% @memberships.each do |membership| %>
        <%= cache membership do %>
        <tr>
          <td><%= image_tag(membership.image_url, class: 'list_image') %></td>
          <td><%= membership.title %></td>
          <td><%= sanitize(membership.description) %></td>
          <td>
            <%= number_to_currency(membership.price) %> <br>
            <%= button_to 'Add to Cart', line_item_path(membership_id: membership) %>
          </td>
        </tr>
        <% end %>
    <% end %>
  <% end %>
</tbody>
...
module CurrentCart

  private

  def set_cart
    @cart = Cart.find(session[:cart_id])
  rescue ActiveRecord::RecordNotFound
    @cart = Cart.create
    session[:cart_id] = @cart.id
  end
end
class Cart < ApplicationRecord
  has_many :line_items, dependent: :destroy
end
class LineItem < ApplicationRecord
  belongs_to :membership
  belongs_to :cart
end
类行项
从2017年7月25日开始记录

Started POST "/line_items/1" for 127.0.0.1 at 2017-08-25 01:14:53 -0700

ActionController::RoutingError (No route matches [POST] "/line_items/1"):

actionpack (5.1.3) lib/action_dispatch/middleware/debug_exceptions.rb:63:in `call'
web-console (3.5.1) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.5.1) lib/web_console/middleware.rb:28:in `block in call'
web-console (3.5.1) lib/web_console/middleware.rb:18:in `catch'
web-console (3.5.1) lib/web_console/middleware.rb:18:in `call'
actionpack (5.1.3) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.1.3) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.1.3) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.1.3) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.1.3) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.1.3) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.1.3) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.0) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.1.3) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.1.3) lib/action_dispatch/middleware/request_id.rb:25:in `call'
rack (2.0.3) lib/rack/method_override.rb:22:in `call'
rack (2.0.3) lib/rack/runtime.rb:22:in `call'
actionpack (5.1.3) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.1.3) lib/action_dispatch/middleware/static.rb:125:in `call'
rack (2.0.3) lib/rack/sendfile.rb:111:in `call'
railties (5.1.3) lib/rails/engine.rb:522:in `call'
puma (3.10.0) lib/puma/configuration.rb:225:in `call'
puma (3.10.0) lib/puma/server.rb:605:in `handle_request'
puma (3.10.0) lib/puma/server.rb:437:in `process_client'
puma (3.10.0) lib/puma/server.rb:301:in `block in run'
puma (3.10.0) lib/puma/thread_pool.rb:120:in `block in spawn_thread'
Started GET "/contribute" for 127.0.0.1 at 2017-08-25 01:14:58 -0700
Processing by ContributeController#index as HTML
  Rendering contribute/index.html.erb within layouts/application
  [1m[35m (0.1ms)[0m  [1m[34mSELECT COUNT(*) AS "size", MAX("memberships"."updated_at") AS timestamp FROM "memberships"[0m
  [1m[36mMembership Load (0.1ms)[0m  [1m[34mSELECT "memberships".* FROM "memberships" ORDER BY "memberships"."title" ASC[0m
  Rendered contribute/index.html.erb within layouts/application (5.8ms)
Completed 500 Internal Server Error in 10ms (ActiveRecord: 0.2ms)



ActionView::Template::Error (No route matches {:action=>"show", :controller=>"line_items", :membership=>:membership_id}, missing required keys: [:id]):
    22:           <td><%= sanitize(membership.description) %></td>
    23:           <td>
    24:             <%= number_to_currency(membership.price) %> <br>
    25:             <%= button_to 'Add to Cart', line_item_path(membership: :membership_id) %>
    26:           </td>
    27:         </tr>
    28:         <% end %>

app/views/contribute/index.html.erb:25:in `block (3 levels) in _app_views_contribute_index_html_erb___1918836646394839137_70338848706380'
app/views/contribute/index.html.erb:18:in `block (2 levels) in _app_views_contribute_index_html_erb___1918836646394839137_70338848706380'
app/views/contribute/index.html.erb:17:in `block in _app_views_contribute_index_html_erb___1918836646394839137_70338848706380'
app/views/contribute/index.html.erb:16:in `_app_views_contribute_index_html_erb___1918836646394839137_70338848706380'
Started GET "/contribute" for 127.0.0.1 at 2017-08-25 01:15:34 -0700
Processing by ContributeController#index as HTML
  Rendering contribute/index.html.erb within layouts/application
  [1m[35m (0.1ms)[0m  [1m[34mSELECT COUNT(*) AS "size", MAX("memberships"."updated_at") AS timestamp FROM "memberships"[0m
  [1m[36mMembership Load (0.1ms)[0m  [1m[34mSELECT "memberships".* FROM "memberships" ORDER BY "memberships"."title" ASC[0m
  Rendered contribute/index.html.erb within layouts/application (5.3ms)
Completed 500 Internal Server Error in 9ms (ActiveRecord: 0.3ms)



ActionView::Template::Error (No route matches {:action=>"show", :controller=>"line_items", :membership_id=>#<Membership id: 1, title: "Rails, Angular, Postgres, and Bootstrap", description: "<p>\n      <em>Powerful, Effective, and Efficient F...", image_url: "dcbang.jpg", price: 0.45e2, created_at: "2017-08-25 05:50:58", updated_at: "2017-08-25 05:50:58">}, missing required keys: [:id]):
    22:           <td><%= sanitize(membership.description) %></td>
    23:           <td>
    24:             <%= number_to_currency(membership.price) %> <br>
    25:             <%= button_to 'Add to Cart', line_item_path(membership_id: membership) %>
    26:           </td>
    27:         </tr>
    28:         <% end %>

app/views/contribute/index.html.erb:25:in `block (3 levels) in _app_views_contribute_index_html_erb___1918836646394839137_70338828018020'
app/views/contribute/index.html.erb:18:in `block (2 levels) in _app_views_contribute_index_html_erb___1918836646394839137_70338828018020'
app/views/contribute/index.html.erb:17:in `block in _app_views_contribute_index_html_erb___1918836646394839137_70338828018020'
app/views/contribute/index.html.erb:16:in `_app_views_contribute_index_html_erb___1918836646394839137_70338828018020'
Started GET "/contribute" for 127.0.0.1 at 2017-08-25 07:16:24 -0700
Processing by ContributeController#index as HTML
  Rendering contribute/index.html.erb within layouts/application
  [1m[35m (0.1ms)[0m  [1m[34mSELECT COUNT(*) AS "size", MAX("memberships"."updated_at") AS timestamp FROM "memberships"[0m
  [1m[36mMembership Load (0.1ms)[0m  [1m[34mSELECT "memberships".* FROM "memberships" ORDER BY "memberships"."title" ASC[0m
  Rendered contribute/index.html.erb within layouts/application (5.0ms)
Completed 500 Internal Server Error in 9ms (ActiveRecord: 0.2ms)



ActionView::Template::Error (No route matches {:action=>"show", :controller=>"line_items", :membership_id=>#<Membership id: 1, title: "Rails, Angular, Postgres, and Bootstrap", description: "<p>\n      <em>Powerful, Effective, and Efficient F...", image_url: "dcbang.jpg", price: 0.45e2, created_at: "2017-08-25 05:50:58", updated_at: "2017-08-25 05:50:58">}, missing required keys: [:id]):
    22:           <td><%= sanitize(membership.description) %></td>
    23:           <td>
    24:             <%= number_to_currency(membership.price) %> <br>
    25:             <%= button_to 'Add to Cart', line_item_path(membership_id: membership) %>
    26:           </td>
    27:         </tr>
    28:         <% end %>

app/views/contribute/index.html.erb:25:in `block (3 levels) in _app_views_contribute_index_html_erb___1918836646394839137_70338848879380'
app/views/contribute/index.html.erb:18:in `block (2 levels) in _app_views_contribute_index_html_erb___1918836646394839137_70338848879380'
app/views/contribute/index.html.erb:17:in `block in _app_views_contribute_index_html_erb___1918836646394839137_70338848879380'
app/views/contribute/index.html.erb:16:in `_app_views_contribute_index_html_erb___1918836646394839137_70338848879380'
Started GET "/contribute" for 127.0.0.1 at 2017-08-25 10:19:16 -0700
Processing by ContributeController#index as HTML
  Rendering contribute/index.html.erb within layouts/application
  [1m[35m (0.1ms)[0m  [1m[34mSELECT COUNT(*) AS "size", MAX("memberships"."updated_at") AS timestamp FROM "memberships"[0m
  [1m[36mMembership Load (0.1ms)[0m  [1m[34mSELECT "memberships".* FROM "memberships" ORDER BY "memberships"."title" ASC[0m
  Rendered contribute/index.html.erb within layouts/application (5.3ms)
Completed 500 Internal Server Error in 10ms (ActiveRecord: 0.2ms)



ActionView::Template::Error (No route matches {:action=>"show", :controller=>"line_items", :line_item=>{:membership_id=>#<Membership id: 1, title: "Rails, Angular, Postgres, and Bootstrap", description: "<p>\n      <em>Powerful, Effective, and Efficient F...", image_url: "dcbang.jpg", price: 0.45e2, created_at: "2017-08-25 05:50:58", updated_at: "2017-08-25 05:50:58">}}, missing required keys: [:id]):
    22:           <td><%= sanitize(membership.description) %></td>
    23:           <td>
    24:             <%= number_to_currency(membership.price) %> <br>
    25:             <%= button_to 'Add to Cart', line_item_path(line_item: {membership_id: membership}) %>
    26:           </td>
    27:         </tr>
    28:         <% end %>

app/views/contribute/index.html.erb:25:in `block (3 levels) in _app_views_contribute_index_html_erb___1918836646394839137_70338828990200'
app/views/contribute/index.html.erb:18:in `block (2 levels) in _app_views_contribute_index_html_erb___1918836646394839137_70338828990200'
app/views/contribute/index.html.erb:17:in `block in _app_views_contribute_index_html_erb___1918836646394839137_70338828990200'
app/views/contribute/index.html.erb:16:in `_app_views_contribute_index_html_erb___1918836646394839137_70338828990200'
Started GET "/contribute" for 127.0.0.1 at 2017-08-25 10:19:29 -0700
Processing by ContributeController#index as HTML
  Rendering contribute/index.html.erb within layouts/application
  [1m[35m (0.1ms)[0m  [1m[34mSELECT COUNT(*) AS "size", MAX("memberships"."updated_at") AS timestamp FROM "memberships"[0m
  [1m[36mMembership Load (0.1ms)[0m  [1m[34mSELECT "memberships".* FROM "memberships" ORDER BY "memberships"."title" ASC[0m
  Rendered contribute/index.html.erb within layouts/application (4.8ms)
Completed 500 Internal Server Error in 8ms (ActiveRecord: 0.2ms)



ActionView::Template::Error (No route matches {:action=>"show", :controller=>"line_items", :membership_id=>#<Membership id: 1, title: "Rails, Angular, Postgres, and Bootstrap", description: "<p>\n      <em>Powerful, Effective, and Efficient F...", image_url: "dcbang.jpg", price: 0.45e2, created_at: "2017-08-25 05:50:58", updated_at: "2017-08-25 05:50:58">}, missing required keys: [:id]):
    22:           <td><%= sanitize(membership.description) %></td>
    23:           <td>
    24:             <%= number_to_currency(membership.price) %> <br>
    25:             <%= button_to 'Add to Cart', line_item_path(membership_id: membership) %>
    26:           </td>
    27:         </tr>
    28:         <% end %>

app/views/contribute/index.html.erb:25:in `block (3 levels) in _app_views_contribute_index_html_erb___1918836646394839137_70338837000860'
app/views/contribute/index.html.erb:18:in `block (2 levels) in _app_views_contribute_index_html_erb___1918836646394839137_70338837000860'
app/views/contribute/index.html.erb:17:in `block in _app_views_contribute_index_html_erb___1918836646394839137_70338837000860'
app/views/contribute/index.html.erb:16:in `_app_views_contribute_index_html_erb___1918836646394839137_70338837000860'
Started GET "/contribute" for 127.0.0.1 at 2017-08-25 10:21:02 -0700
Processing by ContributeController#index as HTML
  Rendering contribute/index.html.erb within layouts/application
  [1m[35m (0.1ms)[0m  [1m[34mSELECT COUNT(*) AS "size", MAX("memberships"."updated_at") AS timestamp FROM "memberships"[0m
  [1m[36mMembership Load (0.1ms)[0m  [1m[34mSELECT "memberships".* FROM "memberships" ORDER BY "memberships"."title" ASC[0m
  Rendered contribute/index.html.erb within layouts/application (5.3ms)
Completed 500 Internal Server Error in 9ms (ActiveRecord: 0.2ms)



ActionView::Template::Error (No route matches {:action=>"show", :controller=>"line_items", :membership_id=>2}, missing required keys: [:id]):
    22:           <td><%= sanitize(membership.description) %></td>
    23:           <td>
    24:             <%= number_to_currency(membership.price) %> <br>
    25:             <%= button_to 'Add to Cart', line_item_path(membership_id: 2) %>
    26:           </td>
    27:         </tr>
    28:         <% end %>

app/views/contribute/index.html.erb:25:in `block (3 levels) in _app_views_contribute_index_html_erb___1918836646394839137_70338847529580'
app/views/contribute/index.html.erb:18:in `block (2 levels) in _app_views_contribute_index_html_erb___1918836646394839137_70338847529580'
app/views/contribute/index.html.erb:17:in `block in _app_views_contribute_index_html_erb___1918836646394839137_70338847529580'
app/views/contribute/index.html.erb:16:in `_app_views_contribute_index_html_erb___1918836646394839137_70338847529580'
Started GET "/contribute" for 127.0.0.1 at 2017-08-25 10:30:29 -0700
Processing by ContributeController#index as HTML
  Rendering contribute/index.html.erb within layouts/application
  [1m[35m (0.1ms)[0m  [1m[34mSELECT COUNT(*) AS "size", MAX("memberships"."updated_at") AS timestamp FROM "memberships"[0m
  [1m[36mMembership Load (0.1ms)[0m  [1m[34mSELECT "memberships".* FROM "memberships" ORDER BY "memberships"."title" ASC[0m
  Rendered contribute/index.html.erb within layouts/application (12.5ms)
Completed 500 Internal Server Error in 20ms (ActiveRecord: 0.7ms)



ActionView::Template::Error (No route matches {:action=>"show", :controller=>"line_items", :membership_id=>#<Membership id: 1, title: "Rails, Angular, Postgres, and Bootstrap", description: "<p>\n      <em>Powerful, Effective, and Efficient F...", image_url: "dcbang.jpg", price: 0.45e2, created_at: "2017-08-25 05:50:58", updated_at: "2017-08-25 05:50:58">}, missing required keys: [:id]):
    22:           <td><%= sanitize(membership.description) %></td>
    23:           <td>
    24:             <%= number_to_currency(membership.price) %> <br>
    25:             <%= button_to 'Add to Cart', line_item_path(membership_id: membership) %>
    26:           </td>
    27:         </tr>
    28:         <% end %>

app/views/contribute/index.html.erb:25:in `block (3 levels) in _app_views_contribute_index_html_erb___1918836646394839137_70338849783140'
app/views/contribute/index.html.erb:18:in `block (2 levels) in _app_views_contribute_index_html_erb___1918836646394839137_70338849783140'
app/views/contribute/index.html.erb:17:in `block in _app_views_contribute_index_html_erb___1918836646394839137_70338849783140'
app/views/contribute/index.html.erb:16:in `_app_views_contribute_index_html_erb___1918836646394839137_70338849783140'
Started GET "/contribute" for 127.0.0.1 at 2017-08-25 10:47:51 -0700
Processing by ContributeController#index as HTML
  Rendering contribute/index.html.erb within layouts/application
  [1m[35m (0.1ms)[0m  [1m[34mSELECT COUNT(*) AS "size", MAX("memberships"."updated_at") AS timestamp FROM "memberships"[0m
  [1m[36mMembership Load (0.1ms)[0m  [1m[34mSELECT "memberships".* FROM "memberships" ORDER BY "memberships"."title" ASC[0m
  Rendered contribute/index.html.erb within layouts/application (5.2ms)
Completed 500 Internal Server Error in 9ms (ActiveRecord: 0.2ms)



ActionView::Template::Error (No route matches {:action=>"show", :controller=>"line_items", :membership_id=>#<Membership id: 1, title: "Rails, Angular, Postgres, and Bootstrap", description: "<p>\n      <em>Powerful, Effective, and Efficient F...", image_url: "dcbang.jpg", price: 0.45e2, created_at: "2017-08-25 05:50:58", updated_at: "2017-08-25 05:50:58">}, missing required keys: [:id]):
    22:           <td><%= sanitize(membership.description) %></td>
    23:           <td>
    24:             <%= number_to_currency(membership.price) %> <br>
    25:             <%= button_to 'Add to Cart', line_item_path(membership_id: membership) %>
    26:           </td>
    27:         </tr>
    28:         <% end %>

app/views/contribute/index.html.erb:25:in `block (3 levels) in _app_views_contribute_index_html_erb___1918836646394839137_70338795119760'
app/views/contribute/index.html.erb:18:in `block (2 levels) in _app_views_contribute_index_html_erb___1918836646394839137_70338795119760'
app/views/contribute/index.html.erb:17:in `block in _app_views_contribute_index_html_erb___1918836646394839137_70338795119760'
app/views/contribute/index.html.erb:16:in `_app_views_contribute_index_html_erb___1918836646394839137_70338795119760'
Started GET "/contribute" for 127.0.0.1 at 2017-08-25 10:48:05 -0700
Processing by ContributeController#index as HTML
  Rendering contribute/index.html.erb within layouts/application
  [1m[35m (0.2ms)[0m  [1m[34mSELECT COUNT(*) AS "size", MAX("memberships"."updated_at") AS timestamp FROM "memberships"[0m
  [1m[36mMembership Load (0.1ms)[0m  [1m[34mSELECT "memberships".* FROM "memberships" ORDER BY "memberships"."title" ASC[0m
  Rendered contribute/index.html.erb within layouts/application (6.0ms)
Completed 500 Internal Server Error in 10ms (ActiveRecord: 0.3ms)



ActionView::Template::Error (No route matches {:action=>"show", :controller=>"line_items", :membership_id=>#<Membership id: 1, title: "Rails, Angular, Postgres, and Bootstrap", description: "<p>\n      <em>Powerful, Effective, and Efficient F...", image_url: "dcbang.jpg", price: 0.45e2, created_at: "2017-08-25 05:50:58", updated_at: "2017-08-25 05:50:58">}, missing required keys: [:id]):
    22:           <td><%= sanitize(membership.description) %></td>
    23:           <td>
    24:             <%= number_to_currency(membership.price) %> <br>
    25:             <%= button_to 'Add to Cart', line_item_path(membership_id: membership) %>
    26:           </td>
    27:         </tr>
    28:         <% end %>

app/views/contribute/index.html.erb:25:in `block (3 levels) in _app_views_contribute_index_html_erb___1918836646394839137_70338835755640'
app/views/contribute/index.html.erb:18:in `block (2 levels) in _app_views_contribute_index_html_erb___1918836646394839137_70338835755640'
app/views/contribute/index.html.erb:17:in `block in _app_views_contribute_index_html_erb___1918836646394839137_70338835755640'
app/views/contribute/index.html.erb:16:in `_app_views_contribute_index_html_erb___1918836646394839137_70338835755640'
Started GET "/contribute" for 127.0.0.1 at 2017-08-25 10:55:17 -0700
Processing by ContributeController#index as HTML
  Rendering contribute/index.html.erb within layouts/application
  [1m[35m (0.1ms)[0m  [1m[34mSELECT COUNT(*) AS "size", MAX("memberships"."updated_at") AS timestamp FROM "memberships"[0m
  [1m[36mMembership Load (0.1ms)[0m  [1m[34mSELECT "memberships".* FROM "memberships" ORDER BY "memberships"."title" ASC[0m
  Rendered contribute/index.html.erb within layouts/application (8.2ms)
Completed 200 OK in 29ms (Views: 27.7ms | ActiveRecord: 0.2ms)


Started GET "/line_items/1" for 127.0.0.1 at 2017-08-25 10:55:18 -0700
Processing by LineItemsController#show as HTML
  Parameters: {"id"=>"1"}
  [1m[36mLineItem Load (0.1ms)[0m  [1m[34mSELECT  "line_items".* FROM "line_items" WHERE "line_items"."id" = ? LIMIT ?[0m  [["id", 1], ["LIMIT", 1]]
Completed 404 Not Found in 8ms (ActiveRecord: 0.5ms)



ActiveRecord::RecordNotFound (Couldn't find LineItem with 'id'=1):

app/controllers/line_items_controller.rb:71:in `set_line_item'
Started GET "/line_items/1" for 127.0.0.1 at 2017-08-25 10:56:44 -0700
Processing by LineItemsController#show as HTML
  Parameters: {"id"=>"1"}
  [1m[36mLineItem Load (0.1ms)[0m  [1m[34mSELECT  "line_items".* FROM "line_items" WHERE "line_items"."id" = ? LIMIT ?[0m  [["id", 1], ["LIMIT", 1]]
Completed 404 Not Found in 5ms (ActiveRecord: 0.7ms)



ActiveRecord::RecordNotFound (Couldn't find LineItem with 'id'=1):

app/controllers/line_items_controller.rb:71:in `set_line_item'
Started GET "/line_items/1" for 127.0.0.1 at 2017-08-25 10:57:00 -0700
Processing by LineItemsController#show as HTML
  Parameters: {"id"=>"1"}
  [1m[36mLineItem Load (0.1ms)[0m  [1m[34mSELECT  "line_items".* FROM "line_items" WHERE "line_items"."id" = ? LIMIT ?[0m  [["id", 1], ["LIMIT", 1]]
Completed 404 Not Found in 5ms (ActiveRecord: 0.7ms)



ActiveRecord::RecordNotFound (Couldn't find LineItem with 'id'=1):

app/controllers/line_items_controller.rb:71:in `set_line_item'
Started GET "/contribute" for 127.0.0.1 at 2017-08-25 10:57:11 -0700
Processing by ContributeController#index as HTML
  Rendering contribute/index.html.erb within layouts/application
  [1m[35m (0.1ms)[0m  [1m[34mSELECT COUNT(*) AS "size", MAX("memberships"."updated_at") AS timestamp FROM "memberships"[0m
  Rendered contribute/index.html.erb within layouts/application (3.4ms)
Completed 200 OK in 22ms (Views: 18.8ms | ActiveRecord: 0.4ms)


Started GET "/line_items/3" for 127.0.0.1 at 2017-08-25 10:57:13 -0700
Processing by LineItemsController#show as HTML
  Parameters: {"id"=>"3"}
  [1m[36mLineItem Load (0.1ms)[0m  [1m[34mSELECT  "line_items".* FROM "line_items" WHERE "line_items"."id" = ? LIMIT ?[0m  [["id", 3], ["LIMIT", 1]]
Completed 404 Not Found in 1ms (ActiveRecord: 0.1ms)



ActiveRecord::RecordNotFound (Couldn't find LineItem with 'id'=3):

app/controllers/line_items_controller.rb:71:in `set_line_item'
2017-08-25 01:14:53-0700发布127.0.0.1的“/code>开始发布“/line_items/1” ActionController::RoutingError(没有与[POST]“/line\u items/1”匹配的路由): actionpack(5.1.3)lib/action\u dispatch/middleware/debug\u exceptions.rb:63:in'call' web控制台(3.5.1)lib/web_控制台/中间件。rb:135:in'call_app' web控制台(3.5.1)lib/web_控制台/中间件。rb:28:in'block in call' web控制台(3.5.1)lib/web_控制台/中间件。rb:18:in'catch' web控制台(3.5.1)lib/web_控制台/中间件。rb:18:in'call' actionpack(5.1.3)lib/action\u dispatch/middleware/show\u exceptions.rb:31:in'call' railties(5.1.3)lib/rails/rack/logger.rb:36:in'call_app' railties(5.1.3)lib/rails/rack/logger.rb:24:in'block in call' activesupport(5.1.3)lib/active\u support/taged\u logging.rb:69:in'block in taged' activesupport(5.1.3)lib/active\u support/taged\u logging.rb:26:in'taged' activesupport(5.1.3)lib/active\u support/taged\u logging.rb:69:in'taged' railties(5.1.3)lib/rails/rack/logger.rb:24:in'call' 链轮轨道(3.2.0)lib/sprockets/rails/quiet_assets.rb:13:in'call' actionpack(5.1.3)lib/action\u dispatch/middleware/remote\u ip.rb:79:in'call' actionpack(5.1.3)lib/action\u dispatch/middleware/request\u id.rb:25:in'call' 框架(2.0.3)lib/rack/method_override.rb:22:in'call' rack(2.0.3)lib/rack/runtime.rb:22:in'call' actionpack(5.1.3)lib/action\u dispatch/middleware/executor.rb:12:in'call' actionpack(5.1.3)lib/action\u dispatch/middleware/static.rb:125:in'call' rack(2.0.3)lib/rack/sendfile.rb:111:in'call' railties(5.1.3)lib/rails/engine.rb:522:in'call' puma(3.10.0)lib/puma/configuration.rb:225:in'call' puma(3.10.0)lib/puma/server.rb:605:in'handle_request' puma(3.10.0)lib/puma/server.rb:437:in'process\u client' puma(3.10.0)lib/puma/server.rb:301:in'block in run' puma(3.10.0)lib/puma/thread_pool.rb:120:in'block in spawn_thread' 2017-08-25 01:14:58-0700开始为127.0.0.1获取“/贡献” ContributeController的处理#索引为HTML 在布局/应用程序中呈现contribute/index.html.erb [1m[35m(0.1ms)[0m[1m[34M]选择计数(*)作为“大小”,最大(“成员身份”,“更新时间”)作为“成员身份”[0m]的时间戳 [1m[36mmbership Load(0.1ms)[0m[1m[34m选择“会员资格”。*从“会员资格”顺序中选择“会员资格”。“头衔”ASC[0m 布局/应用程序中的渲染贡献/index.html.erb(5.8ms) 在10毫秒内完成500个内部服务器错误(ActiveRecord:0.2毫秒) ActionView::Template::Error(没有路由匹配{:action=>“show”,:controller=>“line\u items”,:membership=>:membership\u id},缺少必需的键:[:id]): 22: 23: 24:
25: 26: 27: 28: app/views/contribute/index.html.erb:25:in'block(3层)in_app_view_contribute_index_html_erb_1918836646394839137_70338848706380' app/views/contribute/index.html.erb:18:in`block(2层)in_app_view_contribute_index_html_erb_1918836646394839137_70338848706380' app/views/contribute/index.html.erb:17:in'block in_app_view_contribute_index_html_erb_1918836646394839137_70338848706380' app/views/contribute/index.html.erb:16:in``应用程序视图贡献索引html\erb\uuu 1918836646394839137\u70338848706380' 2017-08-25 01:15:34-0700开始为127.0.0.1获取“/贡献” ContributeController的处理#索引为HTML 在布局/应用程序中呈现contribute/index.html.erb [1m[35m(0.1ms)[0m[1m[34M]选择计数(*)作为“大小”,最大(“成员身份”,“更新时间”)作为“成员身份”[0m]的时间戳 [1m[36mmbership Load(0.1ms)[0m[1m[34m选择“会员资格”。*从“会员资格”顺序中选择“会员资格”。“头衔”ASC[0m 布局/应用程序中呈现的贡献/index.html.erb(5.3ms) 在9毫秒内完成500个内部服务器错误(ActiveRecord:0.3毫秒) ActionView::Template::Error(没有路由匹配{:action=>“show”,:controller=>“line_items”,:membership_id=>#},缺少必需的键:[:id]): 22: 23: 24:
25: 26: 27: 28: app/views/contribute/index.html.erb:25:in'block(3层)in_app_view_contribute_index_html_erb_1918836646394839137_70338828018020' app/views/contribute/index.html.erb:18:in`block(2层)in_app_view_contribute_index_html_erb_1918836646394839137_70338828018020' app/views/contribute/index.html.erb:17:in'block in_app_view_contribute_index_html_erb_1918836646394839137_70338828018020' app/views/contribute/index.html.erb:16:in`_app\u views\u contribute\u index\u html\u erb\u 1918836646394839137\u 70338828018020' 2017-08-25 07:16:24-0700开始为127.0.0.1获取“/贡献” ContributeController的处理#索引为HTML 呈现贡献/index.html。