Search code examples
ruby-on-railsrubysassgemfile

Rails "generate controller" creating .css not .css.scss


So I have a basic gem file where I have specified groups :development and :assets. When I do a rails generate controller welcome index it creates welcome.js and welcome.css.

If I remove the group specifications and run again (even without running "bundle install") it will create the files welcome.js.coffee and welcome.css.scss - the behaviour that I would expect.

I am totally confused at what is happening here. I am pretty new to this so I think it is me misusing a feature rather than a bug. I know I could manually rename the files, its not that I'm too lazy, but that I want to understand the how and why of this behaviour.

This is with a fresh Rails project, only modification is to the gem file.

Gem file:

source 'https://rubygems.org'

gem 'rails', '4.1.4'



group :development do
    gem 'sqlite3'
    gem 'annotate'
end

group :assets do
    gem 'sass-rails', '~> 4.0.3'
    gem 'coffee-rails', '~> 4.0.0'
    gem 'uglifier', '>= 1.3.0'
end


gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0',          group: :doc

gem 'spring',        group: :development

Note that I leave the:

gem 'sdoc', '~> 0.4.0',          group: :doc
gem 'spring',        group: :development

as is in both cases.

Thanks!


Solution

  • group :assets
    

    Is deprecated in Rails 4, so you'll have to remove that line for it to work in that version.