byroot / activerecord-typedstore

ActiveRecord::Store but with type definition
MIT License
439 stars 57 forks source link

Add prefix to attribute definition #43

Open maximebedard opened 8 years ago

maximebedard commented 8 years ago

Whilst adding accessor: false, I thought it would be convenient to add prefix to attributes as well. It also fixes https://github.com/byroot/activerecord-typedstore/issues/7.

Thoughts?

@byroot @rafaelfranca

rafaelfranca commented 8 years ago

LGTM

coveralls commented 8 years ago

Coverage Status

Coverage decreased (-0.09%) to 94.617% when pulling d5d757c0a5cefdcb4da57d778d51685bc03f985f on maximebedard:add-prefix into fff4ec50041dbe5eac272fbce1a0491bc64e4c90 on byroot:master.

coveralls commented 8 years ago

Coverage Status

Coverage decreased (-0.3%) to 94.418% when pulling 9fb6b33e0f2bb028c8ccfb2fb73a35ca04bb6b66 on maximebedard:add-prefix into fff4ec50041dbe5eac272fbce1a0491bc64e4c90 on byroot:master.

natematykiewicz commented 2 years ago

Typed Store looks great! It would really be a good fit to simplify something my team did a long time ago. The one thing that's stopping me from using it is the :prefix option (specifically with a string/symbol prefix). This PR seems very close, except that the regular ActiveRecord Store allows prefix: :foo instead of prefix: true, to prefix the methods with 'foo_' instead of the field name.

Is there anything I can do to help get this PR out and get the string/symbol prefix complete?

Here's the relevant ActiveRecord code. https://github.com/rails/rails/blob/de53ba56cab69fb9707785a397a59ac4aaee9d6f/activerecord/lib/active_record/store.rb#L112-L120

Thanks!

casperisfine commented 2 years ago

Is there anything I can do to help get this PR out and get the string/symbol prefix complete?

This PR is very outdated, but if you feel like submitting a similar one that is rebased, I'll review it.

natematykiewicz commented 2 years ago

Sounds good. Thanks, Jean!

dwillett commented 2 years ago

I was also looking for this functionality as well, so I went ahead and rebased and put up a PR at #91