Skip to content

Commit

Permalink
Fix GH #5411. When precompiling, params method is undefined.
Browse files Browse the repository at this point in the history
  • Loading branch information
kennyj committed Mar 22, 2012
1 parent 35bf748 commit 8c262f7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion actionpack/lib/sprockets/helpers/rails_helper.rb
Expand Up @@ -81,7 +81,7 @@ def stylesheet_path(source)
private private
def debug_assets? def debug_assets?
compile_assets? && (Rails.application.config.assets.debug || params[:debug_assets]) compile_assets? && (Rails.application.config.assets.debug || params[:debug_assets])
rescue NoMethodError rescue NameError
false false
end end


Expand Down
12 changes: 12 additions & 0 deletions railties/test/application/assets_test.rb
Expand Up @@ -492,6 +492,18 @@ class ::PostsController < ActionController::Base; end
assert_match 'src="/sub/uri/assets/rails.png"', File.read("#{app_path}/public/assets/app.js") assert_match 'src="/sub/uri/assets/rails.png"', File.read("#{app_path}/public/assets/app.js")
end end


test "html assets are compiled when executing precompile" do
app_file "app/assets/pages/page.html.erb", "<%= javascript_include_tag :application %>"
ENV["RAILS_ENV"] = "production"
ENV["RAILS_GROUP"] = "assets"

quietly do
Dir.chdir(app_path){ `bundle exec rake assets:precompile` }
end

assert File.exists?("#{app_path}/public/assets/page.html")
end

private private


def app_with_assets_in_view def app_with_assets_in_view
Expand Down

0 comments on commit 8c262f7

Please sign in to comment.