Skip to content

Commit

Permalink
Bump to Ruby 3 (#2978)
Browse files Browse the repository at this point in the history
* Ruby 2.7.5

* Bump to Ruby 3

* Ruby 2.7.5

* Swap to a ruby3 friendly branch

* Ruby

* Bump

* Remove third argument for text columns

* Rubocop

* Splat args

* Rubocop complaints

* Lint
  • Loading branch information
CloCkWeRX authored Apr 19, 2022
1 parent e8318a1 commit bf85040
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.5
3.0.4
21 changes: 12 additions & 9 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@ GIT
sassc-rails (>= 2.0.0)

GEM
remote: https://rubygems.org/
remote: https://rails-assets.org/
specs:
rails-assets-leaflet (1.5.1)
rails-assets-leaflet.markercluster (1.4.1)
rails-assets-leaflet (>= 1.3.1)

GEM
remote: https://rubygems.org/
specs:
abstract_type (0.0.7)
actioncable (6.1.5)
Expand Down Expand Up @@ -448,9 +454,6 @@ GEM
bundler (>= 1.15.0)
railties (= 6.1.5)
sprockets-rails (>= 2.0.0)
rails-assets-leaflet (1.5.1)
rails-assets-leaflet.markercluster (1.4.1)
rails-assets-leaflet (>= 1.3.1)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
Expand Down Expand Up @@ -549,8 +552,8 @@ GEM
ruby-vips (2.1.4)
ffi (~> 1.12)
ruby2_keywords (0.0.5)
ruby_parser (3.14.2)
sexp_processor (~> 4.9)
ruby_parser (3.18.1)
sexp_processor (~> 4.16)
rubyzip (2.3.2)
sass (3.7.4)
sass-listen (~> 4.0.0)
Expand All @@ -577,7 +580,7 @@ GEM
childprocess (>= 0.5, < 5.0)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2)
sexp_processor (4.15.0)
sexp_processor (4.16.0)
sidekiq (6.4.1)
connection_pool (>= 2.2.2)
rack (~> 2.0)
Expand Down Expand Up @@ -745,7 +748,7 @@ DEPENDENCIES
xmlrpc

RUBY VERSION
ruby 2.7.5p203
ruby 3.0.4p208

BUNDLED WITH
1.17.3
2.3.10
10 changes: 5 additions & 5 deletions app/services/crop_search_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ def self.search(query, page: 1, per_page: 12, current_member: nil)
# prioritise crops the member has planted
search_params[:boost_where] = { planters_ids: current_member.id } if current_member

Crop.search(query, search_params)
Crop.search(query, **search_params)
end

def self.random_with_photos(limit)
body = {
"query": {
"function_score": {
"query": { "query_string": { "query": 'has_photos:true' } },
"random_score": { "seed": DateTime.now.to_i }
query: {
function_score: {
query: { query_string: { query: 'has_photos:true' } },
random_score: { seed: DateTime.now.to_i }
}
}
}
Expand Down
25 changes: 9 additions & 16 deletions db/migrate/20150201052245_create_cms.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@

class CreateCms < ActiveRecord::Migration[4.2]
def self.up # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
text_limit = case ActiveRecord::Base.connection.adapter_name
when 'PostgreSQL'
{}
else
{ limit: 16_777_215 }
end

# -- Sites --------------------------------------------------------------
create_table :comfy_cms_sites do |t|
t.string :label, null: false
Expand All @@ -28,9 +21,9 @@ def self.up # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
t.string :app_layout
t.string :label, null: false
t.string :identifier, null: false
t.text :content, text_limit
t.text :css, text_limit
t.text :js, text_limit
t.text :content
t.text :css
t.text :js
t.integer :position, null: false, default: 0
t.boolean :is_shared, null: false, default: false
t.timestamps null: true
Expand All @@ -46,8 +39,8 @@ def self.up # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
t.integer :target_page_id
t.string :label, null: false
t.string :slug
t.string :full_path, null: false
t.text :content_cache, text_limit
t.string :full_path, null: false
t.text :content_cache
t.integer :position, null: false, default: 0
t.integer :children_count, null: false, default: 0
t.boolean :is_published, null: false, default: true
Expand All @@ -59,8 +52,8 @@ def self.up # rubocop:disable Metrics/MethodLength, Metrics/AbcSize

# -- Page Blocks --------------------------------------------------------
create_table :comfy_cms_blocks do |t|
t.string :identifier, null: false
t.text :content, text_limit
t.string :identifier, null: false
t.text :content
t.references :blockable, polymorphic: true
t.timestamps null: true
end
Expand All @@ -72,7 +65,7 @@ def self.up # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
t.integer :site_id, null: false
t.string :label, null: false
t.string :identifier, null: false
t.text :content, text_limit
t.text :content
t.integer :position, null: false, default: 0
t.boolean :is_shared, null: false, default: false
t.timestamps null: true
Expand Down Expand Up @@ -101,7 +94,7 @@ def self.up # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
create_table :comfy_cms_revisions, force: true do |t|
t.string :record_type, null: false
t.integer :record_id, null: false
t.text :data, text_limit
t.text :data
t.datetime :created_at
end
add_index :comfy_cms_revisions, %i(record_type record_id created_at),
Expand Down

0 comments on commit bf85040

Please sign in to comment.