Также опубликовано здесь: https://gist.github.com/1100596. (Эта проблема не относится только к самоцвету CoffeeBeans, я не думаю.)
# Controller
class RestaurantsController < ApplicationController
def show
@restaurant = Restaurant.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.js # show.js.coffee
end
end
end
# restaurants/show.html.erb
<%= link_to "Breakfast", @restaurant, :remote => true, :id => "breakfast_filter" %>
# restaurants/show.js.coffee
alert("here we are");
Почему show.jsФайл .coffee никогда не доходил?На самом деле, даже если бы это был show.js.erb, он не был бы достигнут ...
Все дело в том, чтобы я мог перезагрузить часть страницы show.html.erb с помощью AJAX.
Справочная информация: я использую Rails 3.1rc4, и мой Gemfile выглядит следующим образом:
source 'http://rubygems.org'
# Using ruby 1.9.2p180
gem 'rails', '3.1.0.rc4' # :git => 'git://github.com/rails/rails.git', :branch => '3-1-stable'
gem 'sprockets', '2.0.0.beta.10' # :git => 'git://github.com/sstephenson/sprockets.git'
#gem 'mysql2' # No longer MySQL
gem 'pg', '0.11.0' # For PostgreSQL db
gem 'authlogic', '3.0.3' # smart user authentication
gem 'cancan', '1.6.5' # manage abilities across types of users
gem 'dynamic_form', '1.1.4' # easy error messages for forms
# Asset template engines
gem 'sass-rails', '~> 3.1.0.rc'
gem 'coffee-script', '~> 2.2.0'
gem 'uglifier', '~> 1.0.0' # compresses JS code for production
# We use jQuery, the default
gem 'jquery-rails', '>= 1.0.12'
# Temporary - 3.1 SHOULD require >=0.9.2, but there are still bugs
gem 'rake', '0.8.7'
# This makes AJAX and CoffeeScript play nicely together
gem 'coffeebeans'
group :production do
gem 'therubyracer', '~> 0.9.3.beta1'
end
gem 'factory_girl_rails' # seeds.rb needs this
#gem 'forgery'
group :test, :development do
# helpers
gem 'database_cleaner'
# core testing frameworks
gem 'rspec-rails', '>= 2.6.1'
gem 'cucumber-rails', '>= 1.0.0'
gem 'capybara', '>= 1.0.0'
# Pretty printed test output
gem 'turn', :require => false
end
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
Помощь оценена.