-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#1][Backend] Setup project #24
base: develop
Are you sure you want to change the base?
Conversation
hi @captainnimble ! At Nimble, for the development dependencies (Ruby, Node, Yarn, Elixir,...) we use |
In this project I use
I mention Ruby 3.1 because there is a major change in the gem psych version since Ruby 3.1 that also affects the above version. |
@@ -32,7 +32,8 @@ gem 'jsbundling-rails' # Bundle and transpile JavaScript | |||
gem 'i18n-js', '3.9.0' # A library to provide the I18n translations on the Javascript | |||
# gem 'devise-i18n' # Translations for Devise | |||
|
|||
gem 'psych', '< 4.0' | |||
# Fix Ruby 3.1 that uses psych version 4.0 and conflicts with rails-template |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this comment does not reflect the actual situation. What does it mean by "conflicts with rails-template"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to create a rails app without a template using Ruby 3.2.1
without downgrading Psych to version 3, and everything worked fine. So, I think there will be some issue that does not work properly in the template.
I might be misunderstanding the root issue in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean you created the project without using the Rails template, and it worked, right?
It's because Rails template uses the Figaro gem, and it will break if you use Ruby 3.1 and above (which requires psych v4).
So, even if you initialized the project without the Rails template, later, if you add the Figaro gem (or any other gem that depends on psynch
but has not been updated to work with psynch v4), it will break again.
Check this issue for more details
nimblehq/rails-templates#316.
So instead of forcing psych < 4.0
, I would suggest, either
- Removing the Figaro gem, replacing by https://github.com/bkeepers/dotenv. The end purpose is to allow the loading of different configuration per environment (we're making these changes in Rails template [gh394] Remove the Figaro gem dependency nimblehq/rails-templates#400)
- Downgrading Ruby to a lower version ( Ruby 3.0.x)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also to clarify: in the end, did you use the Rails-template to initialize this project?
@@ -32,7 +32,8 @@ gem 'jsbundling-rails' # Bundle and transpile JavaScript | |||
gem 'i18n-js', '3.9.0' # A library to provide the I18n translations on the Javascript | |||
# gem 'devise-i18n' # Translations for Devise | |||
|
|||
gem 'psych', '< 4.0' | |||
# Fix Ruby 3.1 that uses psych version 4.0 and conflicts with rails-template | |||
gem 'psych', '3.3.4' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the root cause is that Ruby 3.1 comes with psych v4 which is a breaking change. But the gem file here is limiting the version to < 4
already. So why we need to set a specific version 3.3.4
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The line gem 'psych', '< 4.0
, is that I accidentally committed it with initial commit. I think it can make some confused, so I set it to a specific version to have a clear understanding, and 3.3.4 is the latest version before 4.0.
[Backend] Setup project
What happened 👀
To ensure that everything works properly after setting up the project and using the codebase from rails-template on different Ruby versions, Rails versions, and Node versions
< 4.0
to3.3.4
Insight 📝
From this StackOverflow answer, mention is made of a major change in Ruby 3.1 with Psych 4.0 that is incompatible with Ruby 3.0.
For Psych version 4.0.0 or above working with rails-template, there will be an error about saf_load (see picture below).
Proof Of Work 📹
Set gem psych to version below 4.0.0
Running the server locally works properly.