Sass or Foundation Error after updating Rails and other gems - ruby-on-rails

I have recently updated rails and some other gems. However now I get the following error:
Sass::SyntaxError at / Mixin "exports" does not accept a content
block. (in
/Users/mikhailja/Sites/marketing/app/assets/stylesheets/application.css.scss:341)
I'm using:
ruby 2.1.2
rails 4.1.8
sass 3.2.2
sass-rails 2.0.0
foundation-rails 5.4.5.0
The problem went away for a while after trying numerous gem versions but now all of a sudden its back after getting a stack level too deep error.
I've tried the same version of foundation in a new app and it works perfectly.
Any help to get to the bottom of this problem would be very much appreciated.

According to the Foundation github repo, it has to do with a Rails and Sass compatibility issue, which creates a Foundation compatibility issue because of their codebase. Apparently sass-rails has been recently updated to deal with this, and should solve the issue, but I'm not seeing any updates when I update my gems, so best way to deal with it now is probably to downgrade.
Edit: figured it out. In your Gemfile delete the specified version of sass-rails that's autogenerated then run update and you'll get the newest version which will work with the newest version of foundation.

I found a solution. Here is what I did for anyone else experiencing this problem:
Downgraded foundation-rails gem to version 5.1.1.0 (this was my original version) at this point my rails server would not start properly.
Then updated foundation-rails to version 5.3.0.0
I'm not sure if there was just a gem version compatibility issue or if the downgrade/upgrade made the difference.
Anyway, now everything works and my tests are passing!

Related

Ruby 3 overcommit & psych issue

I am upgrading a Rails project to Ruby 3.1.2, from 2.6.6. I initially ran into this problem, but fixed it with adding gem 'psych', '< 4' into the Gemfile. I should note that an answer there mentioned downgrading to Ruby 3.0.3, but that does not fix my issue.
After adding that, the project worked fine regarding Psych. Unfortunately, when trying to commit/push, the overcommit hook returns this error:
/.rbenv/versions/3.1.2/lib/ruby/3.1.0/bundler/runtime.rb:309:in 'check_for_activated_spec!': You have already activated psych 4.0.4, but your Gemfile requires psych 3.3.2. Prepending 'bundle exec' to your command may solve this. (Gem::LoadError)
I also tried changing overcommit's version and got this error:
Since "psych" is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports psych as a default gem.
Is there any way to fix this, or a specific overcommit version that would bypass this error?
Came across similar issue. So, posting here in case it may help somebody.
With Ruby 3, you need to add psych ~>3.0 to the Gemfile explicitly, because the default version of psych which comes bundled with Ruby 3 starts giving errors as it doesn't quite understand how to handle aliases.
If you still wish to use default psych which comes bundled in with Ruby 3. You can load your YAML files like:
YAML.load_file(file_path, aliases: true).
In my case, I had dependencies loading YAML files so I decided to downgrade the psych version instead of loading YAML file with aliases: true.

rails uninitialized constant Sprockets::SassCacheStore

I'm new to rails and trying to do some playing around with gems and such.
My case here is that I have this navigation menu on my website and I needed to get the current_page link selected.. rather than building a helper I wanted to install a gem so I went and looked for one and found this one.
I then followed what the documentation said:
In my gemfile I added
gem 'rack_current_page'
Then in the project root config.ru
require ::File.expand_path('../config/environment', __FILE__)
use Rack::CurrentPage
run Rails.application
And finally I ran:
bundle and rails s only to find out I had this error:
uninitialized constant Sprockets::SassCacheStore
The error happens when including the application stylesheet in the layout file.
I'm using the following packages / versions (only listing what might have impact - if I'm missing something let me know)
(<gem> -v)
Rails 4.2.1
Sprockets 3.0.0
Sass 3.4.13
Rack 1.5
While doing the uninstall I removed every line I added - heck I also reset my project files to head since I just started working on it anyways,
ran a fresh bundle, restarted the server, checked the site but all I'm getting is the error above..
I googled and tried to look for a similar question on SO but couldn't find any so the only thing I could really try was the uninstall and reset my git.
I'm definitely looking over something really stupid but can't really find the answer so here I am ;)
Any help is appriciated, thanks in advance and comment if I missed info that you guys need.
time of writing
I actually did a quick gem pristine --all with no results either.
EDIT 1
Okay, so with abit of guesswork and the same situation happening before resulting in the recreation of a fresh app in the (short) past I uninstalled the compass-rails gem and ran bundle afterwhich rails s to test if things started working.
It did. Then I went on and reinstalled compass-rails and it kept working... getting quite confused now :S
Okay so here goes:
I've found the problem and it was solved by actually supplying a version that works with rails 4.2.
The default gem compass-rails installs a version incompatible with sprockets.
When I added the specific version as seen here and ran another bundle the versions of most of the packages I named in the question changed.
console output after gemfile modification included:
Installing sprockets 2.12.3 (was 3.0.0)
Using sprockets-rails 2.3.1 (was 2.2.4)
Installing sass-rails 5.0.1 (was 5.0.3)
Installing compass-rails 2.0.4 (was 2.0.1)
Guess it's just waiting for compass to release a compatible version.

How do I avoid the circular argument reference warning in activesupport

How do I avoid the circular argument reference warning in activesupport. Happens on ruby 2.2.0
/home/ec2-user/apps/foo_prod/shared/bundle/ruby/2.2.0/gems/activesupport-3.2.21/lib/active_support/values/time_zone.rb:270: warning: circular argument reference - now
/home/ec2-user/apps/foo_prod/shared/bundle/ruby/2.2.0/gems/ruby-ole-1.2.11.7/lib/ole/types/base.rb:265: warning: duplicated key at line 266 ignored: 4095
Use Rails 3.2.22
gem 'rails', '3.2.22'
OR
warning fixes in version 1.2.11.8:
bundle update ruby-ole
This is an issue of Active Support and has been fixed with these two commits:
https://github.com/rails/rails/commit/8fd52705eda6a2cd7e9a8a5bc723fa094e359eb7
https://github.com/rails/rails/commit/3a30b12c774dfaa72acfe520e823374131631ea9
Unfortunately, these commits have been never included into the 3.2 releases,
because the current last release (v3.2.21) was out on 18 Nov 2014
and after that these commits were merged.
If you don't want to see this warning message definitely, you should change
your Gemfile like this:
# gem 'rails', '3.2.21'
gem 'rails', git: 'https://github.com/rails/rails.git', branch: '3-2-stable'
Otherwise, you should downgrade ruby to 2.1 or wait the release of v3.2.22,
which won't come until a grave security hole is found.
After all, there is no easy way to avoid this issue. Changing Gemfile
for such a trivial annoyance may be an overreaction in my view.
It will delay your deployment process quite a lot.
I was not using compass in my application Based on this post here I upped my Rails version from 4.1.1 to 4.1.9 which worked.
This is compass issue here. They haven't release new version yet so you may need to wait for it.
here is what i did to resolve that, i had the latest ruby and the gems are not compatible with that, so after having a fight for nearly a day i switched to older ruby version using rvm
from ruby-2.2.1 to ruby-2.0.0 ,
again this is not an issue with ruby version but incompatibility with gems,try and have good luck with that.
Well, Here is a solution to this:
Try doing all these changes in your .rbenv/.rvm folder and change in these files:
https://github.com/tmm1/rails/commit/8fd52705eda6a2cd7e9a8a5bc723fa094e359eb7
Hypothetically, updating to Rails 4.2.0 - which you should be able to do via the following commands - should fix this error, although it hasn't worked for me:
rvm use ruby-2.2.0#rails4.2 --create
gem install rails
rails -v
I'm getting the same "circular argument error" message as well (I posted more about my failed attempts to fix it here, will update if I find an answer: Rails gem update not working (version 4.1.1 to 4.2.0) as a solution to "warning: circular argument reference" error).
I altered the time_zone.rb file, instead of now=now, I entered now=Time.now and problem solved.
I ran into the same issue as well, yo can sue the following steps to resolve it (worked for me).
$ gem uninstall compass
$ gem update --system
$ gem install compass

Ruby On Rails Heroku APP

I am working on Ruby On Rails Shopify App deployed on Heroku. Suddenly error occured "uninitialized class variable ##storage in ShopifySessionRepository". I was unable to trace this.I rollback the code to previously deployed code and app worked. But now, the code which i have is with errors. So i cannot push any more code to heroku. And i cant even access the code which is working(previous code). I dont how to get out of this situation now. I am new to git, heroku and ruby on rails.Is there any way, i can access the working code using git or anything else. If not, what this error message is "uninitialized class variable ##storage in ShopifySessionRepository" and why it occurred?
I am using rails 4.0.2
This issue occurred because the the version of the shopify gem was automatically upgraded while pushing the code to heroku. Because no version was specified in the gem file for this gem, it was upgraded. The file ShopifySessionRepository was not present in the earlier version of the gem file. This was added in the latest version.
I added the older version of the gem in the gem file like this
gem 'shopify_app','~> 4.4.4'
and it worked. Now i don't know that my code was not compatible with the latest version of the gem or there is any bug in the latest version. But degrading the version solved the issue.
The bug is fixed in the current version of the shopify_app gem, 5.0.0

Globalize and Rails 4: Compatibility status

In a my previous question (asked about 2 months ago) I was trying to upgrade Ruby on Rails from version 3.2.13 to 4.0.0, without success because the globalize3 ruby-gem compatibility. Today I'm trying again to do the upgrade, without success because the globalize3 ruby-gem compatibility.
I tried all possible solutions that I found on the web (even those that refer to the rails4 branch) but no one works for me: I get error outputs as-like those present in my previous question. However, as you can read here, it seems that someone (lucky, maybe) has solved the compatibility issue. I am not a "lucky" one and, since I aim to use features added by Rails 4 and still use globalize3, I would like to know if there is someone running Rails 4 and the globalize3 with success. If so, what did he / she made to make that?
What is the compatibility status between globalize3 and Rails 4?
Note: I also opened a issue at github.
I'm using it with rails 4 and have no issue.
In my Gemfile:
gem 'globalize3', github: 'svenfuchs/globalize3', branch: 'rails4'
Run bundle update instead of bundle install to resolve all dependencies again. Just lock gems that you don't want updated by indicating a version specifier as explained here http://bundler.io/v1.3/gemfile.html.

Resources