私はbest_in_place gemを使用しようとしていますが、動作していないようです。私はrailscastのチュートリアルに従ったが、今は運がいい。私はそれが動作しないと言うとき、私は画面上の何かを編集するオプションがないことを意味します。デフォルトのレール方法で表示されます。best_in_place gemを使用
ポスト/ show.html.erb
<p id="notice"><%= notice %></p>
<p>
<b>
<%= best_in_place @post, :title %>
</b>
</p>
<p>
<%= best_in_place @post ,:content, :type => :text_area %>
</p>
<p>
<b>Featured:</b>
<%= best_in_place @post , :featured, :type => :check_box %>
</p>
<%= link_to 'Edit', edit_post_path(@post) %> |
<%= link_to 'Back', posts_path %>
posts.js.coffee
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
jQuery ->
$('.best_in_place').best_in_place()
application.js
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery_ujs
//= require jquery.purr
//= require best_in_place
//= require_tree
。私はRailsの中に同様のトラブルのためのソリューションを探していました
gemfile
source 'http://rubygems.org'
gem 'best_in_place'
gem 'rails', '3.1.3'
gem 'pg'
gem "paperclip"
group :assets do
gem 'sass-rails', '~> 3.1.5'
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
group :test do
# Pretty printed test output
gem 'turn', '0.8.2', :require => false
end
をブラウザのJavascriptエラーが表示されますか? ChromeでFirebugを使用するか、デベロッパーツールを有効にする必要があります。 – rkb
best_in_placeを追加したところ、アイコンがないことに気付いたようです。私が実際にフィールドをクリックしたときに、それは編集可能になった。私はCSSを持っていなかったことが分かります(多分私はステップを逃した)。使用できるCSSの例については、http://bipapp.heroku.com/users/45を参照してください。これは開発者のデモです。 – Adam21e