Skip to content

Commit

Permalink
Call super from self.inherited
Browse files Browse the repository at this point in the history
  • Loading branch information
shioyama committed Jun 15, 2017
1 parent cbaf70a commit ab0abbf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/mobility.rb
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ def translated_attribute_names

def inherited(subclass)
subclass.instance_variable_set(:@mobility, @mobility)
super
end
end

Expand Down
10 changes: 10 additions & 0 deletions spec/support/shared_examples/querying_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,16 @@
end
end
end

context "with single table inheritance" do
let(:sti_model) { Class.new(model_class) }

it "works with sti model" do
instance = sti_model.create(attribute1 => "foo")
sti_model.i18n.where(attribute1 => "foo")
expect(sti_model.i18n.where(attribute1 => "foo")).to match_array([instance])
end
end
end

describe ".not" do
Expand Down

0 comments on commit ab0abbf

Please sign in to comment.