Rails: Why doesnt all my scss files get compiled? - ruby-on-rails

I am a beginner in rails, and I reckon I haven't got a clear idea on to how the stylesheets should be organised. Currently, I have two files in my assets/stylesheets:
application.css
home.css
When I run rake assets:precompile - I realise that only application.css is compiled into my public/assets folder. What about home.css?
More Info
I want home.css to load only when the respond is received from my home controller. I have removed *= require_tree . from application.css (since I am guessing that home.css would be included in all other pages - am I right?)
The reason I am trying to figure out a solution for this is because heroku throws the following error:
ActionView::Template::Error (home.css isn't precompiled):
2012-04-29T10:48:20+00:00 app[web.1]: 5: <meta name="viewport" content="width=device-width">
2012-04-29T10:48:20+00:00 app[web.1]: 7: = stylesheet_link_tag "application"
2012-04-29T10:48:20+00:00 app[web.1]: 6: = javascript_include_tag "application"
2012-04-29T10:48:20+00:00 app[web.1]: 8: = stylesheet_link_tag params[:controller]
2012-04-29T10:48:20+00:00 app[web.1]: 9: = javascript_include_tag [:controller]
2012-04-29T10:48:20+00:00 app[web.1]: 10: = csrf_meta_tags
2012-04-29T10:48:20+00:00 app[web.1]: 11: %body
2012-04-29T10:48:20+00:00 app[web.1]:
2012-04-29T10:48:20+00:00 app[web.1]: app/views/layouts/application.haml:8:in `_app_views_layouts_application_haml__2082158123561350666_35885340'
2012-04-29T10:48:20+00:00 app[web.1]: cache: [GET /] miss
Any ideas what the problem/mistake is? Thanks!

By default only application.css is compile (see the guide). If you want to change what is precompiled, change config.assets.precompile in application.rb, for example
config.assets.precompile += ['home.css']

Related

Rails 5 unable to deploy on Heroku due to ActionView::Template::Error

I am unable to load a Rails 5 app on Heroku due to the following as per Heroku
ActionView::Template::Error (undefined methodfind_asset' for nil:NilClass)
I am using a theme called Inspinia
I believe I have located the code that is causing the issue, the theme precompiles the assets and when in production heroku is having issues and produces errors. I can't find any clear solution to this issue, heroku won't be able to assist me any further and suggested Stack and not sure there is another way to get the desired effects on the app. I tried remove the find_assets method and it works locally, but causes an H10 error on heroku.
application.html.erb
<!DOCTYPE html>
<html>
<head>
<title>Get Leased Up!</title>
<%= csrf_meta_tags %>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Include style per-controller - vendor plugins -->
<!-- this is where the error comes from -->
<%= stylesheet_link_tag params[:controller] if ::Rails.application.assets.find_asset("#{params[:controller]}.css") %>
<!-- Main css styles -->
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<!-- Main javascript files -->
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
</head>
<body>
...
</body>
assets.rb
Rails.application.config.assets.precompile += %w{ ... }
heroku message and logs
Thanks for reaching out. A 200 status response indicates the request has succeeded, so the log you shared isn't the error. That said, I went ahead and monitored your app while loading the root page and found the following:
2017-08-10T17:27:02.482836+00:00 app[web.1]: I, [2017-08-10T17:27:02.482635 #4] INFO -- : [3c945419-e22f-428f-9212-bebdad98f929] Started GET "/" for 71.198.136.218 at 2017-08-10 17:27:02 +0000
2017-08-10T17:27:02.533224+00:00 app[web.1]: I, [2017-08-10T17:27:02.533084 #4] INFO -- : [3c945419-e22f-428f-9212-bebdad98f929] Processing by LandingController#index as HTML
2017-08-10T17:27:02.596368+00:00 app[web.1]: I, [2017-08-10T17:27:02.596232 #4] INFO -- : [3c945419-e22f-428f-9212-bebdad98f929] Rendering landing/index.html.erb within layouts/application
2017-08-10T17:27:02.645104+00:00 app[web.1]: I, [2017-08-10T17:27:02.644968 #4] INFO -- : [3c945419-e22f-428f-9212-bebdad98f929] Rendered landing/index.html.erb within layouts/application (48.5ms)
2017-08-10T17:27:02.675935+00:00 app[web.1]: I, [2017-08-10T17:27:02.675800 #4] INFO -- : [3c945419-e22f-428f-9212-bebdad98f929] Completed 500 Internal Server Error in 142ms
2017-08-10T17:27:02.677803+00:00 app[web.1]: F, [2017-08-10T17:27:02.677709 #4] FATAL -- : [3c945419-e22f-428f-9212-bebdad98f929]
2017-08-10T17:27:02.677879+00:00 app[web.1]: F, [2017-08-10T17:27:02.677804 #4] FATAL -- : [3c945419-e22f-428f-9212-bebdad98f929] ActionView::Template::Error (undefined method `find_asset' for nil:NilClass):
The issue is ActionView::Template::Error (undefined methodfind_asset' for nil:NilClass)`, so you will need to fix that in order to resolve the issue.
I saw the same problem with building ruby on rails to Heroku.
If you use the statements above to check if an asset exists, remove the little to_s in the end because nil.to_s = "" = tru
There is the same question like this. For more details, please try it.
`undefined method `find_asset' for nil:NilClass`

Deploying my local app with database to Heroku

I am new to Rails, very new to Heroku.
I have just uploaded my application to Heroku.
But when I opened the site, I only see this error message; "We're sorry, but something went wrong."
So I the heroku logs command and here is the log.
It has something to do with the css file but I couldnt understand it...
2013-06-25T19:19:17.196893+00:00 app[web.1]: [2013-06-25 19:19:17] INFO ruby 2.0.0 (2013-05-14) [x86_64-linux]
2013-06-25T19:19:17.196893+00:00 app[web.1]: [2013-06-25 19:19:17] INFO WEBrick 1.3.1
2013-06-25T19:19:17.197592+00:00 app[web.1]: [2013-06-25 19:19:17] INFO WEBrick::HTTPServer#start: pid=2 port=45226
2013-06-25T19:19:17.771088+00:00 heroku[web.1]: State changed from starting to up
2013-06-25T19:20:03.828188+00:00 app[web.1]: => Rails 3.2.13 application starting in production on http://0.0.0.0:45226
2013-06-25T19:20:03.828188+00:00 app[web.1]: => Ctrl-C to shutdown server
2013-06-25T19:20:03.828188+00:00 app[web.1]: => Booting WEBrick
2013-06-25T19:20:03.828188+00:00 app[web.1]: => Call with -d to detach
2013-06-25T19:20:03.828188+00:00 app[web.1]: Started GET "/" for 68.45.84.42 at 2013-06-25 19:20:03 +0000
2013-06-25T19:20:08.600921+00:00 app[web.1]:
2013-06-25T19:20:08.600921+00:00 app[web.1]: ActionView::Template::Error (Invalid CSS after "...abel { font-s ": expected "{", was "}"
2013-06-25T19:20:08.600921+00:00 app[web.1]: 9: <meta name="description" content="fatihnetwork.com | fatih universitesi ogrencileri bulusma platformu" />
2013-06-25T19:20:08.600921+00:00 app[web.1]: 15: </head>
2013-06-25T19:20:08.600921+00:00 app[web.1]: (in /app/app/assets/stylesheets/application.css)):
2013-06-25T19:20:08.601453+00:00 app[web.1]: Compiled omniauth_callbacks.css (2ms) (pid 2)
2013-06-25T19:20:08.600921+00:00 app[web.1]: 10: <meta name="keywords" content="fatih universitesi, fatih, fatih ¸niversitesi ¸niversite, foursquare t¸rkiye, foursquare, four square, facebook, facebook t¸rkiye" />
2013-06-25T19:20:08.600921+00:00 app[web.1]: 13: <%= javascript_include_tag "application" %>
2013-06-25T19:20:08.601131+00:00 app[web.1]:
2013-06-25T19:20:08.601453+00:00 app[web.1]: Processing by HomeController#index as HTML
2013-06-25T19:20:08.601453+00:00 app[web.1]: Rendered home/index.html.erb within layouts/application (4.9ms)
2013-06-25T19:20:08.601453+00:00 app[web.1]: Compiled home.css (119ms) (pid 2)
2013-06-25T19:20:08.600921+00:00 app[web.1]: 12: <%= stylesheet_link_tag "application", :media => "all" %>
2013-06-25T19:20:08.601131+00:00 app[web.1]: app/views/layouts/application.html.erb:12:in `_app_views_layouts_application_html_erb__4210444077502940588_70087393743220'
2013-06-25T19:20:08.601453+00:00 app[web.1]: Compiled application.css (4111ms) (pid 2)
2013-06-25T19:20:08.600921+00:00 app[web.1]: 11: <meta name="Copyright" content="" />
2013-06-25T19:20:08.600921+00:00 app[web.1]: 14: <%= csrf_meta_tags %>
2013-06-25T19:20:08.601131+00:00 app[web.1]:
2013-06-25T19:20:08.601453+00:00 app[web.1]: Completed 500 Internal Server Error in 4241ms
2013-06-25T19:20:08.601453+00:00 app[web.1]: Compiled active_admin.css (3753ms) (pid 2)
You're right, it seems to be a CSS syntax error.
ActionView::Template::Error (Invalid CSS after "...abel { font-s ": expected "{", was "}"
Means that the CSS compiler was expecting an opening bracket "{" but instead got a closing bracket "}" and doesn't know what that means. Try doing a ctrl+f or command+f to find "...abel { font-s " in your code and see if there is a syntax error there.
Hope this helps! :)

Debugging Heroku Deployment (500 Error)

I've been working on deploying my first rails app to heroku for the past few nights and am struggling to figure out how to solve this problem.
I used Michael Hartl's tutorial (http://ruby.railstutorial.org/chapters/beginning#sec-deploying) to make sure I set up my app on the Cedar Stack.
Per the Heroku tutorial, I'm using "thin" as the server.
I've read a bunch of posts and have precompiled my assets using:
heroku run bundle exec rake assets:precompile
bundle exec rake assets:precompile
I have also migrated my databases.
My app works on my localhost.
Here is my gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.8'
gem 'bootstrap-sass', '2.0.0'
gem 'bcrypt-ruby'
gem 'thin'
group :development, :test do
gem 'rspec-rails'
end
group :development do
gem 'sqlite3'
end
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :production do
gem 'pg'
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 :test do
gem 'capybara'
gem 'factory_girl_rails'
end
Here are my heroku logs
2012-09-02T01:56:17+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2012-09-02T01:56:20+00:00 app[web.1]: => Booting Thin
2012-09-02T01:56:20+00:00 app[web.1]: => Rails 3.2.8 application starting in production on http://0.0.0.0:50510
2012-09-02T01:56:20+00:00 app[web.1]: => Call with -d to detach
2012-09-02T01:56:20+00:00 app[web.1]: => Ctrl-C to shutdown server
2012-09-02T01:56:20+00:00 app[web.1]: Connecting to database specified by DATABASE_URL
2012-09-02T01:56:21+00:00 app[web.1]: >> Thin web server (v1.4.1 codename Chromeo)
2012-09-02T01:56:21+00:00 app[web.1]: >> Maximum connections set to 1024
2012-09-02T01:56:21+00:00 app[web.1]: >> Listening on 0.0.0.0:50510, CTRL+C to stop
2012-09-02T01:56:21+00:00 heroku[web.1]: State changed from starting to up
2012-09-02T01:56:23+00:00 app[web.1]:
2012-09-02T01:56:23+00:00 app[web.1]:
2012-09-02T01:56:23+00:00 app[web.1]: Started GET "/" for 108.210.1.241 at 2012-09-02 01:56:23 +0000
2012-09-02T01:56:23+00:00 app[web.1]: Processing by StaticPagesController#home as HTML
2012-09-02T01:56:23+00:00 app[web.1]: Rendered static_pages/home.html.erb within layouts/application (14.9ms)
2012-09-02T01:56:23+00:00 app[web.1]: Completed 500 Internal Server Error in 103ms
2012-09-02T01:56:23+00:00 app[web.1]: ActionView::Template::Error (screen.css isn't precompiled):
2012-09-02T01:56:23+00:00 app[web.1]:
2012-09-02T01:56:23+00:00 app[web.1]: 2: <html>
2012-09-02T01:56:23+00:00 app[web.1]: 3: <head>
2012-09-02T01:56:23+00:00 heroku[router]: GET morning-inlet-9513.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=262ms status=500 bytes=643
2012-09-02T01:56:23+00:00 app[web.1]: 4: <title>GabisBag</title>
2012-09-02T01:56:23+00:00 app[web.1]:
2012-09-02T01:56:23+00:00 app[web.1]: 5: <%= stylesheet_link_tag "screen", :media => "screen" %>
2012-09-02T01:56:23+00:00 app[web.1]:
2012-09-02T01:56:23+00:00 app[web.1]: app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb__1090905269972481286_30934000'
2012-09-02T01:56:23+00:00 app[web.1]: 6: <%= stylesheet_link_tag "landing_pages", :media => "screen" %>
2012-09-02T01:56:23+00:00 app[web.1]: 7: <%= javascript_include_tag "application" %>
2012-09-02T01:56:23+00:00 app[web.1]: 8: <%= csrf_meta_tags %>
2012-09-02T02:05:54+00:00 heroku[api]: Starting process with command `bundle exec rake assets:precompile` by jflores1#alumni.nd.edu
2012-09-02T02:05:57+00:00 heroku[run.1]: Awaiting client
2012-09-02T02:05:57+00:00 heroku[run.1]: Starting process with command `bundle exec rake assets:precompile`
2012-09-02T02:05:58+00:00 heroku[run.1]: State changed from starting to up
2012-09-02T02:06:14+00:00 heroku[run.1]: Client connection closed. Sending SIGHUP to all processes
2012-09-02T02:06:15+00:00 heroku[run.1]: Process exited with status 0
2012-09-02T02:06:15+00:00 heroku[run.1]: State changed from up to complete
2012-09-02T02:08:22+00:00 heroku[slugc]: Slug compilation started
2012-09-02T02:08:37+00:00 heroku[api]: D
eploy 6817a8e by jflores1#alumni.nd.edu
2012-09-02T02:08:37+00:00 heroku[api]: Release v8 created by jflores1#alumni.nd.edu
2012-09-02T02:08:38+00:00 heroku[web.1]: State changed from up to starting
2012-09-02T02:08:38+00:00 heroku[slugc]: Slug compilation finished
2012-09-02T02:08:40+00:00 heroku[web.1]: Starting process with command `bundle exec rails server thin -p 42652 -e production`
2012-09-02T02:08:41+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2012-09-02T02:08:41+00:00 app[web.1]: Exiting
2012-09-02T02:08:42+00:00 heroku[web.1]: Process exited with status 0
2012-09-02T02:08:44+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2012-09-02T02:08:44+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2012-09-02T02:08:47+00:00 app[web.1]: => Booting Thin
2012-09-02T02:08:47+00:00 app[web.1]: => Rails 3.2.8 application starting in production on http://0.0.0.0:42652
2012-09-02T02:08:47+00:00 app[web.1]: => Call with -d to detach
2012-09-02T02:08:47+00:00 app[web.1]: => Ctrl-C to shutdown server
2012-09-02T02:08:47+00:00 app[web.1]: Connecting to database specified by DATABASE_URL
2012-09-02T02:08:48+00:00 app[web.1]: >> Thin web server (v1.4.1 codename Chromeo)
2012-09-02T02:08:48+00:00 app[web.1]: >> Maximum connections set to 1024
2012-09-02T02:08:48+00:00 app[web.1]: >> Listening on 0.0.0.0:42652, CTRL+C to stop
2012-09-02T02:08:49+00:00 heroku[web.1]: State changed from starting to up
2012-09-02T02:08:50+00:00 app[web.1]: Started GET "/" for 108.210.1.241 at 2012-09-02 02:08:50 +0000
2012-09-02T02:08:50+00:00 app[web.1]:
2012-09-02T02:08:50+00:00 app[web.1]:
2012-09-02T02:08:50+00:00 app[web.1]: Processing by StaticPagesController#home as HTML
2012-09-02T02:08:50+00:00 app[web.1]: Rendered static_pages/home.html.erb within layouts/application (9.3ms)
2012-09-02T02:08:50+00:00 app[web.1]: Completed 500 Internal Server Error in 77ms
2012-09-02T02:08:50+00:00 app[web.1]:
2012-09-02T02:08:50+00:00 app[web.1]: ActionView::Template::Error (screen.css isn't precompiled):
2012-09-02T02:08:50+00:00 app[web.1]: 2: <html>
2012-09-02T02:08:50+00:00 app[web.1]: 3: <head>
2012-09-02T02:08:50+00:00 app[web.1]: 4: <title>GabisBag</title>
2012-09-02T02:08:50+00:00 app[web.1]: 5: <%= stylesheet_link_tag "screen", :media => "screen" %>
2012-09-02T02:08:50+00:00 app[web.1]: 6: <%= stylesheet_link_tag "landing_pages", :media => "screen" %>
2012-09-02T02:08:50+00:00 app[web.1]: 7: <%= javascript_include_tag "application" %>
2012-09-02T02:08:50+00:00 app[web.1]: 8: <%= csrf_meta_tags %>
2012-09-02T02:08:50+00:00 app[web.1]: app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb__3619394764979485472_40067220'
2012-09-02T02:08:50+00:00 app[web.1]:
2012-09-02T02:08:50+00:00 app[web.1]:
2012-09-02T02:08:50+00:00 heroku[router]: GET morning-inlet-9513.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=221ms status=500 bytes=643
2012-09-02T02:14:08+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by jflores1#alumni.nd.edu
2012-09-02T02:14:10+00:00 heroku[run.1]: Awaiting client
2012-09-02T02:14:10+00:00 heroku[run.1]: Starting process with command `bundle exec rake db:migrate`
2012-09-02T02:14:11+00:00 heroku[run.1]: State changed from starting to up
2012-09-02T02:14:17+00:00 heroku[run.1]: Client connection closed. Sending SIGHUP to all processes
2012-09-02T02:14:18+00:00 heroku[run.1]: Process exited with status 0
2012-09-02T02:14:18+00:00 heroku[run.1]: State changed from up to complete
2012-09-02T02:14:35+00:00 app[web.1]:
2012-09-02T02:14:35+00:00 app[web.1]: Started GET "/" for 108.210.1.241 at 2012-09-02 02:14:35 +0000
2012-09-02T02:14:35+00:00 app[web.1]:
2012-09-02T02:14:35+00:00 app[web.1]: Processing by StaticPagesController#home as HTML
2012-09-02T02:14:35+00:00 app[web.1]: Rendered static_pages/home.html.erb within layouts/application (0.5ms)
2012-09-02T02:14:35+00:00 app[web.1]: Completed 500 Internal Server Error in 2ms
2012-09-02T02:14:35+00:00 app[web.1]:
2012-09-02T02:14:35+00:00 app[web.1]: ActionView::Template::Error (screen.css isn't precompiled):
2012-09-02T02:14:35+00:00 app[web.1]: 2: <html>
2012-09-02T02:14:35+00:00 app[web.1]: 3: <head>
2012-09-02T02:14:35+00:00 app[web.1]: 4: <title>GabisBag</title>
2012-09-02T02:14:35+00:00 app[web.1]: 5: <%= stylesheet_link_tag "screen", :media => "screen" %>
2012-09-02T02:14:35+00:00 app[web.1]: 6: <%= stylesheet_link_tag "landing_pages", :media => "screen" %>
2012-09-02T02:14:35+00:00 app[web.1]: 7: <%= javascript_include_tag "application" %>
2012-09-02T02:14:35+00:00 app[web.1]: 8: <%= csrf_meta_tags %>
2012-09-02T02:14:35+00:00 app[web.1]: app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb__3619394764979485472_40067220'
2012-09-02T02:14:35+00:00 app[web.1]:
2012-09-02T02:14:35+00:00 app[web.1]:
2012-09-02T02:14:35+00:00 heroku[router]: GET morning-inlet-9513.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=11ms status=500 bytes=643
This looks like the important part:
ActionView::Template::Error (screen.css isn't precompiled):
Seems as though this thread will fix your problem.
As it says:
On heroku server (readonly filesystem), If you want runtime compilation of css (its not recommended but you can do it), make sure you have done settings like below -
# inside config/application.rb
config.assets.enabled = true
config.assets.prefix = Rails.root.join('tmp/assets').to_s
# If you are using sass then keep gem outside of asset group
gem 'sass-rails', '3.1.4'
# inside config/environments/production.rb
config.assets.compile = true
I found the answer here: blueprint css rails 3.1 help
So far as I can tell, this appears to be a problem with using the Blueprint CSS Framework. That said, two other notes:
I commented out the <%= stylesheet_link_tag "screen", :media=>"screen"%> code from my application.html.erb layout file.
I didn't have 'rubyracer' gem installed. I installed it because it was in the gem profiled of the referenced answer. I have no clue what it does.
The URL slashes ("/") are now showing up again wherever I have links. My hunch is that it's something in one of the CSS files that I'm just going to have to dive into and debug. But, the whole reason I had the stylesheet_link_tag thing in the first place was because I was trying to get rid of those pesky slashes. Ultimately, I decided deployment was more important.
Hope this is helpful to someone else!
Here's how I ultimately solved the problem(s). Thanks to the folks who referred me elsewhere so that I could put it all together.
First, I moved Blueprint to a vender directory. I don't think that's crucial to the solution, but it felt cleaner.
The compilation problem:
This thread: blueprint css rails 3.1 help was really helpful. I found Martin and Gary's responses (nos 2 and 3) more helpful than the selected response.
Part of why I was having trouble with compilation (personally) is because I made some edits to the Blueprint files, which meant that they needed to be compiled again before deployment.
This thread: rails 3.1.0 ActionView::Template::Error (application.css isn't precompiled) was helpful in that regard. Basically, just run "Bundle exec rake assets:precompile" before uploading to heroku. I also run "heroku run rake assets:precompile" after upload.
How I got rid of the URL slashes in my links:
The URLs are the result of this code in Blueprint/print.css:
a:link, a:visited {background:transparent;font-weight:700;text-decoration:underline;}
a:link:after, a:visited:after {content:" (" attr(href) ")";font-size:90%;}
I solved the problem by commenting out that code. Of course, after changing the file, you have to rake assets:precompile again. But, that got it all working!

Heroku deploy fails after upgrading to bootstrap 2.0.1 via twitter-bootstrap-rails gem

UPDATE:
this error is shown during git push heroku master :
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
couldn't find file 'twitter/bootstrap'
(in /tmp/build_2pmsvze33th3e/app/assets/javascripts/application.js:9)
Tasks: TOP => assets:precompile:primary
(See full trace by running task with --trace)
Precompiling assets failed, enabling runtime asset compilation
Injecting rails31_enable_runtime_asset_compilation
Please see this article for troubleshooting help:
http://devcenter.heroku.com/articles/rails31_heroku_cedar#troubleshooting
I upgraded Bootstrap 2 layout to 2.0.1 by following this guide. After that I get this error deploing to Heroku :
2012-02-23T23:12:09+00:00 app[web.1]: ActionView::Template::Error ('twitter/bootstrap.less' wasn't found.
2012-02-23T23:12:09+00:00 app[web.1]:
2012-02-23T23:12:09+00:00 app[web.1]: (in /app/app/assets/stylesheets/bootstrap.css.less)):
2012-02-23T23:12:09+00:00 app[web.1]: 7: /%title gitwatcher.com
2012-02-23T23:12:09+00:00 app[web.1]: 8: = csrf_meta_tags
2012-02-23T23:12:09+00:00 app[web.1]: 9: = stylesheet_link_tag "vendor", :media => "screen"
2012-02-23T23:12:09+00:00 app[web.1]: 10: = stylesheet_link_tag "application", :rel => "stylesheet"
2012-02-23T23:12:09+00:00 app[web.1]: 11: = stylesheet_link_tag "http://jqueryui.com/repository/tags/latest/themes/base/jquery.ui.all.css", :media => "screen, projection"
2012-02-23T23:12:09+00:00 app[web.1]: 12: /
2012-02-23T23:12:09+00:00 app[web.1]: 13: :css
2012-02-23T23:12:09+00:00 app[web.1]: app/views/layouts/application.html.haml:10:in `_app_views_layouts_application_html_haml___2608554683581233975_52490540'
2012-02-23T23:12:09+00:00 app[web.1]:
2012-02-23T23:12:09+00:00 app[web.1]:
2012-02-23T23:12:09+00:00 app[web.1]: cache: [GET /] miss
2012-02-23T23:12:09+00:00 app[web.1]: Processing by HomeController#index as HTML
2012-02-23T23:12:09+00:00 app[web.1]: Rendered shared/_watch-list-tab.html.haml (4.5ms)
2012-02-23T23:12:09+00:00 app[web.1]: Rendered shared/_watch-list-table.html.haml (30.2ms)
2012-02-23T23:12:09+00:00 app[web.1]: Rendered home/index.html.haml within layouts/application (101.7ms)
2012-02-23T23:12:09+00:00 app[web.1]: Compiled vendor.css (3ms) (pid 1)
2012-02-23T23:12:09+00:00 app[web.1]: Compiled css3-github-buttons/gh-buttons.css (0ms) (pid 1)
2012-02-23T23:12:09+00:00 app[web.1]: Compiled jquery_carousel/carousel.css (0ms) (pid 1)
2012-02-23T23:12:09+00:00 app[web.1]: Compiled application.css (2ms) (pid 1)
2012-02-23T23:12:09+00:00 app[web.1]: Completed 500 Internal Server Error in 858ms
Previously I got an existing Rails 3.1.3 app already working with Bootstrap 2 layout on Heroku Cedar.
Any idea ?
Remove the following file app/assets/stylesheets/bootstrap.css.less and enjoy.
Soruce https://github.com/seyhunak/twitter-bootstrap-rails/issues/123
I also moved gem "twitter-bootstrap-rails" outside the assets group and that works!
I was able to fix this issue by simply moving gem "twitter-bootstrap-rails" out of the :assets block and putting it at the top of my gemfile.
Solved.
Simply by comment out the following line in Gemfile :
#gem 'twitter-bootstrap-rails', :git => 'http://github.com/seyhunak/twitter-bootstrap-rails.git'
and using gem "twitter-bootstrap-rails", "~> 2.0.1.0" then running bundle update
To be complete, my previous failing branch was :
- revision: a5d67d23afeaa76eb52c6f87d55ff407f9c753f2
- twitter-bootstrap-rails (2.0.1)
For me the solution was to remove this line in application.css
*= require twitter/bootstrap
Se https://github.com/seyhunak/twitter-bootstrap-rails/issues/123
Another workaround for errors during runtime asset compilation is to use the asset_sync gem.

ArgumentError with rails 3.2.0.rc1 stylesheet_link_tag in skeleton application

I created a new rails 3.2.0.rc1 app and generated a welcome controller with an index action. I fixed the routes so that root points to this action and I removed the index.html placeholder file. When I try and load the root page I am getting an error "wrong number of arguments (3 for 2)" related to welcome.css.scss and the stylesheet_link_tag line in application.html.erb. If I rename the welcome.css.scss file to welcome.css, the page loads fine.
Did I miss a special config step for the release candidate? I am using ruby 1.9.2.
Thanks.
I'm experiencing the same with 3.2rc1 on 1.9.3-p0
Started GET "/" for 127.0.0.1 at 2012-01-08 21:18:59 -0800
Processing by HomeController#index as HTML
Rendered home/index.html.erb within layouts/application (3.5ms)
Completed 500 Internal Server Error in 81ms
ActionView::Template::Error (wrong number of arguments (3 for 2)
(in /Users/dan/Sites/appname/app/assets/stylesheets/home.css.scss)):
2: <html>
3: <head>
4: <title>Appname</title>
5: <%= stylesheet_link_tag "application" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %>
8: </head>
app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb__3426015066428469059_70355741377500'
Rendered /Users/dan/.rbenv/versions/1.9.3-rc1/lib/ruby/gems/1.9.1/gems/actionpack-3.2.0.rc1/lib/action_dispatch/middleware/templates/rescues/_trace.erb (9.5ms)
Rendered /Users/dan/.rbenv/versions/1.9.3-rc1/lib/ruby/gems/1.9.1/gems/actionpack-3.2.0.rc1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.6ms)
Rendered /Users/dan/.rbenv/versions/1.9.3-rc1/lib/ruby/gems/1.9.1/gems/actionpack-3.2.0.rc1/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (15.2ms)
My home.css.scss is as follows
// Place all the styles related to the home controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
Looks like it was rc1 bug.
I've just switched on rails 3.2.0.rc2, and this problem has disappeared.

Resources