【问题标题】:Undefined method `best_in_place' on production server生产服务器上未定义的方法“best_in_place”
【发布时间】:2013-05-16 15:55:42
【问题描述】:

我开始使用 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'

【问题讨论】:

  • 能否确认gem是否从Gemfile.lock安装?
  • gem 在 gemfile.lock 中列出
  • 你能把 Gemfile 贴在你包含它的地方吗?
  • 我刚刚编辑了我的问题以包含它
  • ssh 进入您的服务器并捆绑打开 best_in_place。如果它出错,则 bundle 不知道它。

标签: ruby-on-rails-3 best-in-place


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2012-05-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-07
    • 2014-05-16
    • 2012-02-19
    相关资源
    最近更新 更多