Bhushan Lodha
Bhushan Lodha

Reputation: 6862

uninitialized constant Sass::Rails::SassTemplate

I am using Rails 3.1.1 and active_admin gem. Everything is running perfect in Development env but when I try to do rake db:migrate in Production env I get this error

   uninitialized constant Sass::Rails::SassTemplate

What might be the issue and how do I fix it?

In my gemfile i have gem 'sass-rails', '~> 3.1.4'

Upvotes: 3

Views: 4503

Answers (2)

Guillaume
Guillaume

Reputation: 21736

The answer by Spencer gives the right solution. But to avoid you to look at the two issues in GitHub and wondering which of the multiple propositions work -pushing to production just to test this can be tedious-, let me explicit the fix:

The sass-rails gem must be taken out of the :assets group:

gem 'sass-rails'

gem 'activeadmin' # (sass-rails must be loaded before!)
  gem 'meta_search',    '>= 1.1.1'
#end

group :assets do
  # Remove the line gem 'sass-rails' from here
end

As activeadmin uses sass, I assumed the sass line must appear before activeadmin. But I did not test the other way.

In case anyone wonders, the indentation of the meta_search line and the #end is just my way of remembering why I added this other gem. Just a hint to my future self that if I remove the gem activeadmin, there is a high chance that I can also remove the gem meta_search.

Upvotes: 7

Spencer Williams
Spencer Williams

Reputation: 922

would either of these two github issues relate to your problem? I see they're submitted by the same person, but they may receive different replies.

Upvotes: 1

Related Questions