Skip to content

Commit

Permalink
Fix wrong example code in RDoc for Model#{set,update}_fields
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyevans committed Apr 14, 2011
1 parent 4139dd9 commit 6e65d3b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/sequel/model/base.rb
Expand Up @@ -1086,10 +1086,10 @@ def set_except(hash, *except)
# For each of the fields in the given array +fields+, call the setter # For each of the fields in the given array +fields+, call the setter
# method with the value of that +hash+ entry for the field. Returns self. # method with the value of that +hash+ entry for the field. Returns self.
# #
# artist.set_fields({:name=>'Jim'}, :name) # artist.set_fields({:name=>'Jim'}, [:name])
# artist.name # => 'Jim' # artist.name # => 'Jim'
# #
# artist.set_fields({:hometown=>'LA'}, :name) # artist.set_fields({:hometown=>'LA'}, [:name])
# artist.name # => nil # artist.name # => nil
# artist.hometown # => 'Sac' # artist.hometown # => 'Sac'
def set_fields(hash, fields) def set_fields(hash, fields)
Expand Down Expand Up @@ -1149,10 +1149,10 @@ def update_except(hash, *except)
# Update the instances values by calling +set_fields+ with the +hash+ # Update the instances values by calling +set_fields+ with the +hash+
# and +fields+, then save any changes to the record. Returns self. # and +fields+, then save any changes to the record. Returns self.
# #
# artist.update_fields({:name=>'Jim'}, :name) # artist.update_fields({:name=>'Jim'}, [:name])
# # UPDATE artists SET name = 'Jim' WHERE (id = 1) # # UPDATE artists SET name = 'Jim' WHERE (id = 1)
# #
# artist.update_fields({:hometown=>'LA'}, :name) # artist.update_fields({:hometown=>'LA'}, [:name])
# # UPDATE artists SET name = NULL WHERE (id = 1) # # UPDATE artists SET name = NULL WHERE (id = 1)
def update_fields(hash, fields) def update_fields(hash, fields)
set_fields(hash, fields) set_fields(hash, fields)
Expand Down

0 comments on commit 6e65d3b

Please sign in to comment.