Skip to content

Commit e00a771

Browse files
authored
Merge pull request #321 from smoyth/patch-1
Remove options restrictions on has_closure_tree_root
2 parents e9cebd9 + 46deebd commit e00a771

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

lib/closure_tree/has_closure_tree_root.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,7 @@ class RootOrderingDisabledError < StandardError; end
55
module HasClosureTreeRoot
66

77
def has_closure_tree_root(assoc_name, options = {})
8-
options.assert_valid_keys(
9-
:class_name,
10-
:foreign_key
11-
)
12-
13-
options[:class_name] ||= assoc_name.to_s.sub(/\Aroot_/, "").classify
8+
options[:class_name] ||= assoc_name.to_s.sub(/\Aroot_/, "").classify
149
options[:foreign_key] ||= self.name.underscore << "_id"
1510

1611
has_one assoc_name, -> { where(parent: nil) }, options

0 commit comments

Comments
 (0)