简体   繁体   中英

rails 3.1 javascript help

im using rails 3.1.4.rc5 and my javascript doesnt seem to be working. in my layout header i have the javascript include :defaults link, but for some reason when I write even the simplest of js code in my assets directory it doesn't show up.

the file i've been trying to edit is assets/javascripts/orders.js.coffee and ive just been trying to do an alert "hello" (because i heard you don't have to use parentheses with coffee and i can't get it to work. i also tried alert("hello") just to be sure.

if you look at the script tag when the website is loaded it says the source is /assets/default.js

heres my gemfile:

source 'http://rubygems.org'

gem 'rails', '3.1.0.rc5'

# Bundle edge Rails instead:
# gem 'rails',     :git => 'git://github.com/rails/rails.git'

gem 'devise'
gem 'omniauth'

gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git'
gem 'ckeditor'
gem 'paperclip'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails', "~> 3.1.0.rc"
  gem 'coffee-rails', "~> 3.1.0.rc"
  gem 'uglifier'
end

gem 'execjs'
gem 'jquery-rails'

group :development do
  gem 'sqlite3'
end

group :production do
  gem 'therubyracer-heroku', '0.8.1.pre3'
  gem 'pg'
end

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

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'

group :test do
  # Pretty printed test output
  gem 'turn', :require => false
end

试试javascript_include_tag "application"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM