Binding.pry not showing the stopping point in console after ruby 3 upgrade - ruby-on-rails

I am new to ruby, we have a ROR microservice(rails version 6.1) , recently i updated the ruby version on the service from 2.7 to 3.0 , after this since there were failures and i wanted to debug it, so i added binding.pry , when the binding.pry is encountered the flow stops but its doesnt show the exact line where the binding.pry has stopped in the console and no matter what command i give it conitnues the flow .
screenshot of console when binding.pry is encountered in code
Below are the relevant gems versions from gemfile
ruby '>=3.0'
gem 'rails', '~> 6.1'
gem 'pry', '~> 0.10.3'
gem 'pry-byebug', '~> 3.4'
gem 'pry-rails', '~> 0.3'
gem 'rdoc', '>= 6.3.1'
gem 'webrick', '~> 1.8'
I want to get the binding.pry to work properly, how it used to with older ruby 2.7 version, so that i could debug the actual issues that the service is facing after 3.0 upgrade Please suggest me guys.

Related

rails upgrading from 5.0.0.1 to rails rails 5.1 issues in installing gems

I want to upgrade an old legacy app from rails 5.0 to rails 5.1 then so on until rails 7
I have dockerized the app for easiness
please read the Gemfile, which gems are supported in Rails 7
terminal:
$ docker-compose run rails bundle install
terminal logs:
An error occurred while installing nio4r (2.5.8), and Bundler cannot continue.
In Gemfile:
rename was resolved to 1.0.8, which depends on
rails was resolved to 5.2.8.1, which depends on
actioncable was resolved to 5.2.8.1, which depends on
nio4r
this is my Gemfile: app/Gemfile
I have removed the Gemfile.lock to avoid conflicts in version that were locked
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem 'rails', '~> 5.1'
gem 'mysql2'
gem 'sassc'
gem 'sass'
# gem 'sass-rails', git:'https://github.com/sass/sassc-rails.git', branch: 'master'
gem 'sassc-rails'
gem 'uglifier'
gem 'coffee-rails'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'turbolinks'
gem 'jquery-turbolinks'
gem 'js_cookie_rails'
gem 'jbuilder'
gem 'sdoc', group: :doc
gem 'rake'
gem 'kaminari'
gem 'slim-rails'
gem 'rack-user_agent'
gem 'gmail'
gem 'whenever'
gem 'actionpack-action_caching'
gem 'breadcrumbs_on_rails'
gem 'execjs'
gem 'ltsv-logger'
gem 'therubyracer'
# 問い合わせなどの画像認証
gem 'scout_apm'
gem "recaptcha", require: "recaptcha/rails"
gem 'sentry-raven'
gem 'faraday'
gem 'faraday_middleware'
gem 'config'
gem 'font-awesome-rails'
Are you working from the Rails guide for updating versions?
Don't start with Rails 7 in mind. Just do one minor version bump at a time (5.1, 5.2, 6.0 etc... you don't have to worry about patch numbers) and make sure it works in production before moving on.
Also, if there are changes that break in version x.x, you can usually make those changes in x.x-1 before you upgrade to x.x. I suggest doing as much as you can before you get to the point of upgrading Rails and other gems.
In this case, is your app already working with Rails 5.1 (and how have you evaluated that)?
Bundler is trying to install Rails 5.2 because rails '~> 5.1' will find the latest 5.x version that is equal or greater than 5.1. If you're not sure your app is working on 5.1 yet, start there by adding a patch version so you get the latest 5.1.x: `gem 'rails', '~> 5.1.0'.
Once you've got the version number right in your Gemfile, you're on to the next step of the guide:
Change the Rails version number in the Gemfile and run bundle update
(now do the rest of the steps)

Syntax Error after upgrading to Rails 5.2

My tests are failing like so.
SyntaxError:
/Users/myname/.rvm/gems/ruby-2.2.5#myproject/gems/capybara-3.2.1/lib/capybara/session.rb:129: syntax error, unexpected '.'
#server&.wait_for_pending_requests
This happens after I upgraded to Rails 5.2 from 5.0.3. My current Gem file is as following.
source 'https://rubygems.org'
gem 'rails', '~> 5.2.0'
group :test do
gem 'capybara-screenshot'
end
group :development, :test do
gem 'rspec-rails', '~> 3.6.0'
gem 'guard'
gem 'guard-rspec'
gem "factory_girl_rails"
gem 'capybara'
gem "capybara-webkit"
end
can someone help me before I lose all my hairs? Thanks so much.
You are using Ruby version 2.2.5 and you are also upgrading capybara to version 3.2.1. If you take a look at the line that causes the syntax error, the commit message give you a hint: Require minimum of Ruby 2.3.0
If you look at the history, capybara version 3.2.0 requires Ruby 2.3.0+.
You can either upgrade your applications Ruby version to 2.3.0 or greater, or set your capybara version to a prior version.

Phusion error: undefined method `has?' for Sass::Util:Module

I get the following error issued by Phusion when loading a web page:
There was an error while trying to load the gem 'compass-rails'.
Gem Load Error is: undefined method `has?' for Sass::Util:Module
Did you mean? hash
Hash
Backtrace for gem load error is:
/Volumes/Data/htdocs/zetcho/vendor/bundle/gems/compass-0.12.2/lib/compass/sass_extensions/functions/urls.rb:5:in `has?'
The code at the indicated location is:
module Compass::SassExtensions::Functions::Urls
def self.has?(base, instance_method)
Sass::Util.has?(:instance_method, base, instance_method)
end
My gem file contains:
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.2'
# Use mysql as the database for Active Record
gem 'mysql2', '~> 0.3.18'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Compass for stylesheets
gem 'compass-rails'
# Use the Compass extension susy
gem "sprockets"
gem 'susy'
I've just created the Ruby on Rails site using Rails 5.1.2 and ruby 2.3.1. I have a much older site that works fine with the gem. Did I miss a step in the overall install or is this a bug with compass-rails?
I got the same error when I tried to add a controller:
rails generate controller home index
After more digging around, I found a similar problem. I fixed this one by changing the gem file to:
gem 'compass-rails', github: 'Compass/compass-rails'
Then:
rm gemfile.lock
bundle
It seems that the issue can be found in compass-rails 2.0.0. The version 3.0.2 seems to fix this issues. So a possible solution is :
# Gemfile
gem 'compass-rails', '~> 3.0.2'
Then bundle update compass-rails
This avoids targeting the compass-rails git master branch in favor of an actual release.
I came here having the same issue with a grunt compiling issue trying to use Compass/Sass, if this might help someone, my issue was caused because I had an updated version of Sass (sass-3.7.4) that was higher that the max-version compatible with compass, I uninstalled sass:
gem uninstall sass
Which in turn uninstalled compass, and reinstalled compass letting it choose the right version, and problem solved.
gem install compass

Something went wrong error Rails 5.0.0 alpha

Ruby on Rails newbie, learning the framework :-)
I am trying to set up dev environment and get to welcome aboard page (default Rails server page) in localhost:3000.
Environment details:
(RVM managed) Ruby 2.2.2 and 2.2.3 on OSX
But tried only on Ruby 2.2.2.
Installed Rails by creating a new project folder (does not have any special characters) and a Gemfile with below entries
source 'https://rubygems.org'
gem 'rails', github:'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'rack', github: 'rack/rack'
gem 'sass-rails', github: 'rails/sass-rails'
gem 'sprockets', github: 'rails/sprockets'
gem 'sprockets-rails', '3.0.0.beta2'
bundle install command was successful (verified rails -v showed Rails 5.0.0 alpha)
issued rails new . command and replaced the existing Gemfile (got an error that unable to install Rails5.0.0 I guess Rails5.0.0 is not available as a Gem)
so manually updated the Gemfile, now it looks like below
source 'https://rubygems.org'
gem 'rails', github:'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'rack', github: 'rack/rack'
gem 'sass-rails', github: 'rails/sass-rails'
gem 'sprockets', github: 'rails/sprockets'
gem 'sprockets-rails', '3.0.0.beta2'
gem 'sqlite3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
group :development, :test do
gem 'byebug'
end
group :development do
gem 'web-console', '~> 2.0'
gem 'spring'
end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
Issued bundle update command and verified that rails -v shows Rails 5.0.0 alpha.
If I start rails server using rails server and hit http://localhost:3000/ I see something went wrong error page and the server logs does not show any useful messages :(
rails s
=> Booting WEBrick
=> Rails 5.0.0.alpha application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2015-09-15 22:20:37] INFO WEBrick 1.3.1
[2015-09-15 22:20:37] INFO ruby 2.2.2 (2015-04-13) [x86_64-darwin14]
[2015-09-15 22:20:37] INFO WEBrick::HTTPServer#start: pid=69775 port=3000
DEPRECATION WARNING: before_filter is deprecated and will be removed in Rails 5.1. Use before_action instead. (called from block (3 levels) in <class:Engine> at /Users/manikandanviswanathan/.rvm/gems/ruby-2.2.2#Rails5/gems/turbolinks-2.5.3/lib/turbolinks.rb:14)
DEPRECATION WARNING: after_filter is deprecated and will be removed in Rails 5.1. Use after_action instead. (called from block (3 levels) in <class:Engine> at /Users/manikandanviswanathan/.rvm/gems/ruby-2.2.2#Rails5/gems/turbolinks-2.5.3/lib/turbolinks.rb:15)
Started GET "/" for ::1 at 2015-09-15 22:20:39 -0700
On a side note Rails4.2.2 is working well in my machine !
any help/advice is much appreciated.
Thanks !
Lessons learnt:
Don`t start learning anything in alpha version - there is a reason they version it in alpha version.
Unless you are not fixing the bugs in alpha version - its better not to seek advice
So As per #sevenseacat`s advice I dropped the idea of learning in Rails alpha version. I installed current stable version rails 4.2.4 and started developing tutorial app.
At this point I do not understand what #huan-son recommendation about precompiling assets - but I have reserved it for future to research more on it.
#all : Thanks a lot for the help/advice. Much appreciated.

Ruby on Rails installed on windows getting ExecJS::ProgramError

I'm working on a project which I normally work on Mac OSX. I'm on ruby MRI V.1.9.3-p194 and rails v.3.2.8.
but, for the time being, there has been a need to collaborate the project source code with another team member who's using windows.
I proceeded on to set up everything on my colleague's windows machine and almost everything seems to work quite well, the same ruby and rails framework version are used. I managed to get 'bundle install' to pass by having most of their dependencies resolved. (So, you can imagine that the versions of gems have got updated from those on my Mac Machine)
I also have node.js installed on my colleague's machine in order to make ruby able to run javascript.
A while later, it seemed I was able to start the web server using "bundle exec thin start" and it's starting without any error. The other reason, I'm quite sure my setup's been coming in the right way
because I can retrieve model records via rail console beautifully. But I'm only getting one error, every time I try to browse to the app on the web browser.
Every time I'm getting node.js dependency error "cannot find module 'stylus'"
that even prevents me from getting the login page loaded.
here is a snapshot of the error I get:
also, I'm happy to share you my Gemfile, so it could give you more clues what actually goes wrong? it can be found below:
source 'http://rubygems.org'
gem 'rails', '3.2.8'
gem 'rubyzip', '< 1.0.0'
gem 'roo','1.12.1'
gem 'mysql2', '0.3.11'
gem 'jquery-rails', '2.1.2'
gem 'haml', '3.1.7'
gem 'thin', '1.4.1'
group :development do
gem 'capistrano', '2.13.4'
end
gem 'devise', '2.1.2'
gem 'devise-async', '0.5.0'
gem 'cancan', '1.6.8'
gem 'simple_form', '2.0.4'
gem 'cocoon', '1.1.1'
gem 'inherited_resources', '1.3.1'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.9'
gem 'mechanize', '2.5.1'
gem 'delayed_job', '3.0.4'
gem 'paperclip', '3.4.0'
gem 'spreadsheet', '0.6.4.1'
gem 'geocoder', '1.1.6'
gem 'whenever', '0.8.2'
gem 'american_date', '1.0.0'
gem 'money','5.1.1'
gem 'rets','0.5.1'
gem 'haversine','0.3.0'
gem 'capybara'
gem 'poltergeist'
gem 'selenium-webdriver'
gem 'redis'
gem 'execjs','2.0.0'
group :assets do
gem 'stylus', '0.7.1'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '1.3.0'
end
What should I do to get this to work? Any help would be greatly appreciated.
Updated:
I updated my question rgrd Brad suggestion accordingly.
I've performed as suggested. but when I have node.js uninstalled, I rather got another error like below "The node.js runtime is not available". any idea?
You can see the answer here
I changed from coffee-script-source 1.12.2 to 1.8.0 in Gemfile.lock file.
ex) coffee-script-source (1.8.0)
And then, in cmd, I put a command like 'bundle install'.
If you do not have a bundle, you can install bundle such as
gem install bundle
Finally, turn off your rails server and turn on again.
Thank you.

Resources