NoBrainerORM / nobrainer

Ruby ORM for RethinkDB
http://nobrainer.io/
Other
387 stars 49 forks source link

Add support for the `store_accessor` method #280

Closed zedtux closed 2 years ago

zedtux commented 2 years ago

Some gems are using this method which allows to tell the column name where to store a given key:

class Subscription
  store_accessor :data, :paddle_update_url
end

This store_accessor method simply define getter/setter and dirty methods for the given keys.

Then one can access the column/key from the object instance:

# This would insert a new subscription with a `:data` field
# with the `Hash` type storing the key `:paddle_update_url`
# with the value `https://...`.
subscription = Subscription.new(paddle_update_url: 'https://...')
subscription.paddle_update_url
#=> 'https://...'