activerecord-typedstore icon indicating copy to clipboard operation
activerecord-typedstore copied to clipboard

Add prefix to attribute definition

Open maximebedard opened this issue 8 years ago • 7 comments

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

maximebedard avatar Jun 13 '16 02:06 maximebedard

LGTM

rafaelfranca avatar Jun 13 '16 02:06 rafaelfranca

Coverage Status

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

coveralls avatar Jun 13 '16 02:06 coveralls

Coverage Status

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

coveralls avatar Jun 13 '16 03:06 coveralls

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!

natematykiewicz avatar Mar 09 '22 23:03 natematykiewicz

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.

casperisfine avatar Mar 10 '22 08:03 casperisfine

Sounds good. Thanks, Jean!

natematykiewicz avatar Mar 11 '22 04:03 natematykiewicz

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

dwillett avatar Mar 17 '22 00:03 dwillett