Updated app to rails 7 by benjaminfaure · Pull Request #3426 · DMPRoadmap/roadmap

@benjaminfaure

@benjaminfaure

aaronskiba

Addresses the following error that was encountered when attempting to execute the GitHub Actions that correspond with the edited workflows files:

https://github.com/DMPRoadmap/roadmap/actions/runs/9513143079/job/26222602325
3s

```
Run bundle exec rails db:create RAILS_ENV=test
To use retry middleware with Faraday v2.0+, install `faraday-retry` gem
To use multipart middleware with Faraday v2.0+, install `faraday-multipart` gem; note: this is used by the ManageGHES client for uploading licenses
Copying Bootstrap glyphicons to the public directory ...
Copying TinyMCE skins to the public directory ...
/home/runner/work/roadmap/roadmap/config/initializers/recaptcha.rb:8:in `block in <main>': undefined method `[]' for nil:NilClass (NoMethodError)
	from /home/runner/work/roadmap/roadmap/vendor/bundle/ruby/3.0.0/gems/recaptcha-5.17.0/lib/recaptcha.rb:37:in `configure'
	from /home/runner/work/roadmap/roadmap/config/initializers/recaptcha.rb:7:in `<main>'
```
Prior to this commit, the Rails credentials were not being updated during this setup process.

@aaronskiba

@aaronskiba

Omitting the arguments results in lambda implicitly using self, which appears to be the desired behaviour here. It also resolves the Rubocop offences.
`template.visibilty` now returns a string rather than an integer.

The Rails 7 upgrade actually fixes a couple of bugs within `app/views/org_admin/templates/_form.html.erb` and `app/views/org_admin/templates/_show.html.erb`. Prior to this upgrade, template.visibility would return an integer. Now that it is returning a string, the `f.object.visibility == 'organisationally_visible'` and `template.visibility == 'organisationally_visible'` checks within the aforementioned files are behaving as desired.

@aaronskiba

Prior to this commit, the default checked/unchecked values were used (i.e. "1" would be returned when checked, and "0" would be returned when unchecked). However, the box is meant to be checked when selecting 'organisationally_visible' ('for internal %{org_name} use only'), which makes the default checked/unchecked values opposite to the mapping of our enums (i.e. `{"organisationally_visible"=>0, "publicly_visible"=>1}`).
Rails 7 appears to apply stricter parsing rules. If the Content-Type is not JSON, then the body will not be parsed as JSON.

@aaronskiba

Fix PostgreSQL GitHub Action and Tests For Rails 7 Upgrade
Added `coder:` and `type:` keywords in various places to address deprecation warnings.

Example warning (before adding `type: ` keyword in `app/models/user.rb`:
````
Please pass the class as a keyword argument:

  serialize :prefs, type: Hash
 (called from <class:User> at /path/to/app/models/user.rb:73)
DEPRECATION WARNING: Passing the class as positional argument is deprecated and will be removed in Rails 7.2.
```
This change addresses the following deprecation warnings:
```
DEPRECATION WARNING: Setting action_dispatch.show_exceptions to false is deprecated. Set to :none instead. (called from rescue in call at /usr/share/rvm/gems/ruby-3.0.5@upstream/gems/actionpack-7.1.3.4/lib/action_dispatch/middleware/debug_exceptions.rb:43)
DEPRECATION WARNING: Setting action_dispatch.show_exceptions to false is deprecated. Set to :none instead. (called from rescue in call at /usr/share/rvm/gems/ruby-3.0.5@upstream/gems/actionpack-7.1.3.4/lib/action_dispatch/middleware/show_exceptions.rb:36)
```
Address Deprecation Warnings

@benjaminfaure

@aaronskiba