Can start a new Rails app with Ruby 2.5.0 but not in 2.5.3

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Can start a new Rails app with Ruby 2.5.0 but not in 2.5.3

Jason Hsu, Ruby on High Speed Rails
My development environment has rbenv with Ruby 2.5.0 and 2.5.3.  I can start a new Rails app in Ruby 2.5.0 but not in Ruby 2.5.3.  Here's the script I'm using for creating a quick and dirty Rails app:
```
#!/bin/bash

# This script creates a basic Rails app that uses an SQLite database.
# PURPOSE: Provide confirmation that Ruby on Rails is properly set up.

# This is the same test app as the one at http://elinux.org/RPi_Ruby_on_Rails .
cd /home/winner/shared && rails new school_sq --skip-spring
cd /home/winner/shared/school_sq && rails g scaffold Pupil name:string form:string
cd /home/winner/shared/school_sq && rake db:migrate

echo '**********************'
echo 'OPEN YOUR WEB BROWSER.'
echo 'GO TO THE FOLLOWING URL:'
echo 'http://localhost:3000/pupils'

echo '***************'
echo 'IMPORTANT NOTE:'
echo 'The port number listed above assumes a zero offset for the port number.'
echo 'If you are using a non-zero offset in Docker,'
echo 'you must adjust the above port number accordingly.'
echo '**************************************************'

echo ''
cat /home/winner/shared/ports.txt
echo ''

echo '*************************************************************************'
echo "You can use access the database in this app's db/development.sqlite3 file"
echo 'by using SQLite database browser.'
echo '*********************************'
cd /home/winner/shared/school_sq && rails s -b 0.0.0.0 -p 3000
```

When I run this script in Ruby 2.5.0, I have no problems.  Everything works as expected.

But when I run this script in Ruby 2.5.3 (rbenv global 2.5.3), I keep getting error messages:
1.  When I first run the script, I get the message "Your Ruby version is 2.5.3, but your Gemfile specified 2.5.0" during the "bundle install" part.  It turns out that the Gemfile specifies Ruby 2.5.0.  (WHY does Rails app generator insist on Ruby 2.5.0 instead of 2.5.3?)
2.  When I correct the Gemfile, I get the message "Your Ruby version is 2.5.0, but your Gemfile specified 2.5.3" when I run "rails db:migrate".
3.  When I enter "bin/rails db:migrate RAILS_ENV=development", the error message doesn't appear.  However, I get the message "Your Ruby version is 2.5.0, but your Gemfile specified 2.5.3" when I enter "rails s -b 0.0.0.0 -p 3000".

I have some apps in Ruby 2.5.0.  I want to upgrade them to 2.5.3, but I get a similar conundrum.  So I'm sticking with Ruby 2.5.0, because stagnation is better than breakage.

Why is Ruby 2.5.3 such a problem?  Should I just wait for 2.6.0 to be released before upgrading?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/13ff8729-0090-4d5f-937f-8c875c94b92d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Can start a new Rails app with Ruby 2.5.0 but not in 2.5.3

Stefan Buhrmester
2.5.3 works perfectly fine for me. have you tried `rbenv rehash` after switching ruby versions?

On Thu, Nov 29, 2018 at 2:55 PM Jason Hsu <[hidden email]> wrote:
My development environment has rbenv with Ruby 2.5.0 and 2.5.3.  I can start a new Rails app in Ruby 2.5.0 but not in Ruby 2.5.3.  Here's the script I'm using for creating a quick and dirty Rails app:
```
#!/bin/bash

# This script creates a basic Rails app that uses an SQLite database.
# PURPOSE: Provide confirmation that Ruby on Rails is properly set up.

# This is the same test app as the one at http://elinux.org/RPi_Ruby_on_Rails .
cd /home/winner/shared && rails new school_sq --skip-spring
cd /home/winner/shared/school_sq && rails g scaffold Pupil name:string form:string
cd /home/winner/shared/school_sq && rake db:migrate

echo '**********************'
echo 'OPEN YOUR WEB BROWSER.'
echo 'GO TO THE FOLLOWING URL:'
echo 'http://localhost:3000/pupils'

echo '***************'
echo 'IMPORTANT NOTE:'
echo 'The port number listed above assumes a zero offset for the port number.'
echo 'If you are using a non-zero offset in Docker,'
echo 'you must adjust the above port number accordingly.'
echo '**************************************************'

echo ''
cat /home/winner/shared/ports.txt
echo ''

echo '*************************************************************************'
echo "You can use access the database in this app's db/development.sqlite3 file"
echo 'by using SQLite database browser.'
echo '*********************************'
cd /home/winner/shared/school_sq && rails s -b 0.0.0.0 -p 3000
```

When I run this script in Ruby 2.5.0, I have no problems.  Everything works as expected.

But when I run this script in Ruby 2.5.3 (rbenv global 2.5.3), I keep getting error messages:
1.  When I first run the script, I get the message "Your Ruby version is 2.5.3, but your Gemfile specified 2.5.0" during the "bundle install" part.  It turns out that the Gemfile specifies Ruby 2.5.0.  (WHY does Rails app generator insist on Ruby 2.5.0 instead of 2.5.3?)
2.  When I correct the Gemfile, I get the message "Your Ruby version is 2.5.0, but your Gemfile specified 2.5.3" when I run "rails db:migrate".
3.  When I enter "bin/rails db:migrate RAILS_ENV=development", the error message doesn't appear.  However, I get the message "Your Ruby version is 2.5.0, but your Gemfile specified 2.5.3" when I enter "rails s -b 0.0.0.0 -p 3000".

I have some apps in Ruby 2.5.0.  I want to upgrade them to 2.5.3, but I get a similar conundrum.  So I'm sticking with Ruby 2.5.0, because stagnation is better than breakage.

Why is Ruby 2.5.3 such a problem?  Should I just wait for 2.6.0 to be released before upgrading?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/13ff8729-0090-4d5f-937f-8c875c94b92d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CANhkrbSuU9Wg%3DjVUhHQ%2BR13BFDWKBgHGnckb_oZiYtsNx%2BTE3g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Can start a new Rails app with Ruby 2.5.0 but not in 2.5.3

Colin Law
In reply to this post by Jason Hsu, Ruby on High Speed Rails
On Thu, 29 Nov 2018 at 05:54, Jason Hsu <[hidden email]> wrote:
>
> 2.  When I correct the Gemfile, I get the message "Your Ruby version is 2.5.0, but your Gemfile specified 2.5.3" when I run "rails db:migrate".

Did you run bundle install after changing the ruby version in Gemfile?

Colin

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLsPiKYWO1qprQh53RFUfA_Zevn-ccuTR5s57JNECB-%2BnA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.