Ruby On Rails Heroku APP - ruby-on-rails

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

Related

Rails Version Resolving Issue

The root cause of my problem is that json 1.8.3 won't install. The original version of rails in my gem file was 4.1.14. I changed it to 4.1.16 and ran bundle update. json 1.8.6 was then installed locally.
However, when I deploy to Heroku, it still resolves the rails version to 4.1.16 and tries installing json 1.8.3 (which fails).
What can I do to resolve this issue and be able to successfully deploy my app?
The gem version should never resolve differently. That's the whole purpose of the Gemfile.lock.
Ensure that you have committed and pushed any changes to the Gemfile.lock.
If the file is not in source control (e.g. if you've added it to .gitignore?), then don't do that -- the file should be in source control.

how can i find what version of rails my app is running on?

I am trying to run an old rails app, but I am receiving this error after calling $ rails server:
uninitialized constant AppGenerator::Config
Did you mean? RbConfig
I am brand new to Rails, and I really don't know what this means/where to start. The app is supposedly built on 2.3.8. My computer says I have 2.4.1 and 2.3.18 installed.
I would like to know if I should install 2.3.8, or if I should upgrade to the latest version? Also I don't understand the error that is coming up, where should I look in the app to fix this - or is this a Rails problem?
Verify the version your project is built type bundle show inside it. It's gonna show all the gems and your respective versions.
And to check the rails version just type rails -v in your terminal.
The gemfile in the app folder should tell you what version of rails it is.
You can use bundle update to update the version or if you have a newer version and want an older version, do gem uninstall rails and then gem install rails -v "version number" for example, gem install rails -v 2.3.8.
You can check the rails version on Gemfile.
Try the command rake about to see the application environment.
I would suggest to have your environment setup same on the Gemfile, your application might have compatibility issues if you use a lower version.

Sass or Foundation Error after updating Rails and other gems

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!

Bootstrap::FrameworkNotFound on heroku?

I am using rails 3.2 and have built an application on my development server and it is working fine. But when I deploy the same application to my heroku account I get this error:
/app/vendor/bundle/ruby/1.9.1/gems/bootstrap-sass-2.3.0.1/lib/bootstrap-sass.rb:18:in `load!': bootstrap-sass requires either Rails > 3.1 or Compass, neither of which are loaded (Bootstrap::FrameworkNotFound)
Does anyone know how to fix it. The bootstrap-sass gem is a dependency for the rails_admin gem.
Add this to your gemfile
gem 'less-rails'
Try this,it might work for you.I got somewhat similar error and i resolved using this.

Downgrading from Rails 3.2.6 to 3.0.11

I am facing issue when I am trying to work with rails 3.0.11. I initially worked with rails 3.2.6. Build a prototype application in Rails 3.2.6, Ruby 1.9.2 and gem 1.8.7. But then found, server on which we need to host is a shared server which can only support Rails 3.0.11, Ruby 1.8.7 and gem 1.7.2.
Hence I want to keep my dev environment exactly same before I ran into further issues. As I found there was some discrepancy in routes.rb of both the versions.
Steps I followed:
Uninstalled rails
Uninstalled ruby
Installed ruby from here.
This installed ruby version 1.8.7-p370 and gem 1.8.7
After this I installed rails by specifying version as 3.0.11
But still when I run command rails -v, it throws an error to me saying 'missing gem rails 3.2.6. Run bundle install to resolve the issue'
When I ran bundle install, it again completely installed rails 3.2.6 and problem remained unresolved.
Please suggest the clean way how shall I start my development on rails 3.0.11 without running into any issues?? Am I need to delete some registry or mapping in my system through which it is detecting rails 3.2.6 and creating issues??
Its urgent as I need to complete my dev by 7th September.
As I am new to stackexchange, please guide is it appropriate to ask question on the same related thread or shall I open new discussion for my problem?
#Gun - please note in response to one of your comments posted above - you DO need to change your Gemfile - if you are running rails -v from withing your project's directory, it will read the Gemfile.
There is a script located at script/rails - this is what runs when you run the rails command from the project directory. NOTE that this rails script requires your config/application.rb file - which in turn reads the Gemfile and bundles the referenced gems. Thus is your Gemfile still references 3.2.6, and it is not installed, rails -v will not work
Glad to hear the problem is fixed :)
As for the asset pipeline - if you are using rails 3.2.6 (or were using it) then you may have been using the asset pipeline to serve your assets (javascript files, CSS files, images, etc). If you were, and you downgrade to anything pre rails version 3.1, then anything being served through the asset pipeline will no longer work.
Here is a pretty good description of the asset pipeline: http://guides.rubyonrails.org/asset_pipeline.html
You should check also remove your Gemfile.lock or manually 'bundle update rails' when you change your rails dependency.
I suggest to use rbenv or rvm to create a virtual environment/sandbox where you can install your preferred ruby versions (e.g. 1.8.7) and keep tracking of your dependencies separately. This would save you a lot of effort.
Keep in mind that rails 3.0 has no asset pipeline support (it has been included in rails 3.1)! This is a very important difference and if you depend on it you will have big issues to solve for the downgrade.
Thanks a lot everyone for help.
I believe it was weird issue. I had heroku on the system. I was initially deploying my app on the same and then changed to another hosting server.
After uninstalling the heroku, it works perfectly fine. Probably, that was interfering somewhere. Although, not sure but problem is resolved.
Thanks a lot again for a great great help!!!
Meanwhile, I would request alup to throw some more light on asset pipeline support. Wots that? Could you please explain more??
Need to delete C:\Users\.ror folder and C:\Users\.gemfile and C:\Users\.gemfile.lock from your desktop..

Resources