1

我开始使用 best_in_place gem。它在我的本地开发机器上运行良好,但是当我将代码部署到生产服务器时,我得到:

ActionView::Template::Error (undefined method `best_in_place' for #<#<Class:0xc088ef8>:0xba694a0>):
    76:               <% t.each do |ticket| %>
    77:                 <tr>
    78:                   <td><%= check_box_tag "tickets[ids][]", ticket.id, false, :class => "status_change" %></td>
    79:                   <td><%= best_in_place ticket, :position, {:inner_class => "input-mini", :type => :input} %></td>
    80:                   <td><%= ticket.id %></td>
    81:                   <td><%= ticket.job_number %></td>
    82:                   <td><%= link_to ticket.name, edit_ticket_path(ticket) %></td>
  app/views/tickets/index.html.erb:79:in `block (3 levels) in _app_views_tickets_index_html_erb___947812068_98658810'
  app/views/tickets/index.html.erb:76:in `block (2 levels) in _app_views_tickets_index_html_erb___947812068_98658810'
  app/views/tickets/index.html.erb:56:in `each'
  app/views/tickets/index.html.erb:56:in `block in _app_views_tickets_index_html_erb___947812068_98658810'
  app/views/tickets/index.html.erb:50:in `_app_views_tickets_index_html_erb___947812068_98658810'
  app/controllers/tickets_controller.rb:11:in `index'

就好像没有安装gem一样。我确实确保我做了一个bundle install.

看法:

<td><%= best_in_place ticket, :position, {:inner_class => "input-mini", :type => :input} %></td>

宝石文件:

source 'https://rubygems.org'

gem 'rails', '3.2.11'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :development do
    gem 'sqlite3'
end


# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

group :production do
    gem "mysql", "~>2.8.1"
end

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'

gem 'devise'
gem 'best_in_place'
gem 'paper_trail'
gem 'ckeditor_rails'
gem 'bootstrap-sass'
gem 'bootstrap-datepicker-rails'
gem 'carrierwave'
gem 'ransack'
gem 'nested_form'
gem 'will_paginate'
gem 'capistrano'
gem 'therubyracer'
4

1 回答 1

1

我最终不得不重新启动服务器并独立重新启动乘客。在此之后, best_in_place 起作用了。我不确定为什么会这样,但如果有人愿意扩展可能发生的事情,我会更改他们解决方案的正确答案。

于 2013-06-05T23:01:50.477 回答