File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -507,10 +507,12 @@ def attributes(*attrs)
507507 end
508508 end
509509
510- def attribute ( attr , options = { } )
510+ def attribute ( attribute_name , options = { } )
511+ attr = attribute_name . to_sym
512+
511513 check_reserved_attribute_name ( attr )
512514
513- if ( attr . to_sym == :id ) && ( options [ :format ] . nil? )
515+ if ( attr == :id ) && ( options [ :format ] . nil? )
514516 ActiveSupport ::Deprecation . warn ( 'Id without format is no longer supported. Please remove ids from attributes, or specify a format.' )
515517 end
516518
@@ -1041,7 +1043,8 @@ def _add_relationship(klass, *attrs)
10411043 options = attrs . extract_options!
10421044 options [ :parent_resource ] = self
10431045
1044- attrs . each do |relationship_name |
1046+ attrs . each do |name |
1047+ relationship_name = name . to_sym
10451048 check_reserved_relationship_name ( relationship_name )
10461049 check_duplicate_relationship_name ( relationship_name )
10471050
Original file line number Diff line number Diff line change @@ -1462,12 +1462,12 @@ class PersonResource < PersonResource; end
14621462 class PostResource < PostResource ; end
14631463
14641464 class BookResource < JSONAPI ::Resource
1465- attribute : title
1465+ attribute " title"
14661466 attributes :isbn , :banned
14671467
1468- has_many : authors
1468+ has_many " authors"
14691469
1470- has_many : book_comments, relation_name : -> ( options = { } ) {
1470+ has_many " book_comments" , relation_name : -> ( options = { } ) {
14711471 context = options [ :context ]
14721472 current_user = context ? context [ :current_user ] : nil
14731473
@@ -1478,7 +1478,7 @@ class BookResource < JSONAPI::Resource
14781478 end
14791479 } , reflect : true
14801480
1481- has_many : aliased_comments, class_name : 'BookComments' , relation_name : :approved_book_comments
1481+ has_many " aliased_comments" , class_name : 'BookComments' , relation_name : :approved_book_comments
14821482
14831483 filters :book_comments
14841484 filter :banned , apply : :apply_filter_banned
You can’t perform that action at this time.
0 commit comments