Skip to content

Commit

Permalink
fix tableless and tests in rails 7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
scambra committed Jan 8, 2025
1 parent 759a52d commit 768a67b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
fail-fast: false
matrix:
ruby: [ "3.3", "3.2", "3.1" ]
rails: [ "7.1", "7.0", "6.1" ] # TODO test 7.2
rails: [ "7.2" "7.1", "7.0", "6.1" ]
include:
- ruby: jruby-9.4
rails: '6.1'
Expand All @@ -98,7 +98,7 @@ jobs:
- ruby: '3.0'
rails: '7.0'
- ruby: '3.3'
rails: '7.1'
rails: '7.2'
coverage: true
timeout-minutes: 60
env:
Expand Down
10 changes: 3 additions & 7 deletions lib/active_scaffold/tableless.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
class ActiveScaffold::Tableless < ActiveRecord::Base # rubocop:disable Rails/ApplicationRecord
class AssociationScope < ActiveRecord::Associations::AssociationScope
INSTANCE = create
def self.scope(association, connection)
INSTANCE.scope association, connection
end
end

class Connection < ActiveRecord::ConnectionAdapters::AbstractAdapter
attr_reader :klass

Expand Down Expand Up @@ -150,8 +143,11 @@ def exec_queries

class Relation < ::ActiveRecord::Relation
include RelationExtension

delegate :connection_pool, to: :model
end
class << self
delegate :schema_cache, to: :connection
def find(*ids)
ids.length == 1 ? all.find(*ids[0]) : super # rubocop:disable Rails/RedundantActiveRecordAllMethod
end
Expand Down
2 changes: 2 additions & 0 deletions test/model_stub.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class ModelStub < ActiveRecord::Base
@@nested_scope_calls = []
cattr_accessor :nested_scope_calls

def self.schema_loaded? = true

def self.a_is_defined
@@nested_scope_calls << :a_is_defined
self
Expand Down

0 comments on commit 768a67b

Please sign in to comment.