Skip to content

Commit 89212c4

Browse files
authored
[Rails] Add meta.model.rails on classes that inherit from ApplicationRecord (sublimehq#3077)
1 parent a247887 commit 89212c4

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Rails/Ruby on Rails.sublime-syntax

+2-2
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ contexts:
159159
- match: ^\1(?=end)\b
160160
pop: true
161161
- include: embedded-expressions
162-
# Uses lookahead to match classes that (may) inherit from ActiveRecord::Base
163-
- match: (^\s*)(?=class\s+.+ActiveRecord::Base\b)
162+
# Uses lookahead to match classes that (may) inherit from ActiveRecord::Base or ApplicationRecord
163+
- match: (^\s*)(?=class\s+.+(ActiveRecord::Base|ApplicationRecord)\b)
164164
push:
165165
- meta_scope: meta.model.rails
166166
- match: ^\1(?=end)\b

Rails/syntax_test_rails.rb

+9
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,16 @@ def find_model
2424
end
2525
end
2626

27+
class Product < ActiveRecord::Base
28+
29+
# <- meta.model.rails
30+
31+
end
32+
2733
class PictureFile < ApplicationRecord
34+
35+
# <- meta.model.rails
36+
2837
after_commit :delete_picture_file_from_disk, on: :destroy
2938
# ^ support.function.activerecord.rails
3039

0 commit comments

Comments
 (0)