linernutri.blogg.se

Rails postgres json query
Rails postgres json query










  1. #RAILS POSTGRES JSON QUERY UPGRADE#
  2. #RAILS POSTGRES JSON QUERY SOFTWARE#
  3. #RAILS POSTGRES JSON QUERY CODE#

#RAILS POSTGRES JSON QUERY SOFTWARE#

I realize that in many contemporary software development environments, it’s not always possible to work this way. This sometimes leads me to holding back on satisfying feature requests, even if they come with pull requests, even if it seems like “not that much code” - if I’m not confident it can fit into the architecture in a consistent way.

#RAILS POSTGRES JSON QUERY CODE#

And very careful about getting the fundamental architectural design of the code solid in the first place - coming up with something that is parsimonious (few architectural “concepts”) and consistent and coherent, but can handle what you will want to throw at it. To really get stability and backwards compatibility over time, one needs to be very careful about what one introduces into the codebase in the first place. In working on this and other projects, I’ve come to think of a way of working on software that might be called “slow code”. I think this is a testament to it’s stability and reliability, rather than to any (almost non-existent) marketing I’ve done. But I’m pleased it has successfully gotten some traction from other users - 390 github “stars” is respectable if not huge, with occasional Issues and PR’s from third parties. Occasionally changes to the test harness are needed when a new Rails version comes out, but I actually can’t think of any changes needed to implementation itself for new Rails versions, although there may have been a few.īecause, yeah, it is true that this is still basically a one-maintainer project. I think this succesfully makes maintenance easier for downstream users of attr_json, while also demonstrating success at prioritizing maintainability of attr_json itself - it hasn’t needed a whole lot of work on my end to keep working across Rails releases. (also grateful to the quality and stability of the rails attributes API originally created by sgrif). The last attr_json 1.x release actually supported (in same codebase) Rails 5.0 through Rails 7.0 (!), and attr_json 2.0 supports 6.0 through 7.0. I know that management of rails “plugin” dependencies can end up a nightmare, and I feel good about avoiding this with attr_json.Īttr_json was actually originally developed for Rails 4.2 (!!), and has kept working all the way to Rails 7. Generally, I try to really prioritize backwards compatibility and maintainability, doing my best to avoid anything that could provide backwards incompat between major releases, and trying to keep major releases infrequent. And it comes three and a half years after the 1.0 release.

#RAILS POSTGRES JSON QUERY UPGRADE#

While the 2.0 release includes a few backwards incompats, it really should be an easy upgrade for most if not everyone. Slow cadence, stability and maintainability We get some aspects of a schema-less json-document-store, but embedded in postgres, without giving up rdbms features or ordinary ActiveRecord affordances.

rails postgres json query

One use case where I think attr_json really excels is when using Rails Single-Table Inheritance, where different sub-classes may have different attributes.Īnd especially for a “content management system” type of use case, where on top of that single-table inheritance polymorphism, you can have complex hierarchical data structures, in an inheritance hierarchichy, where you don’t actually want or need the complexity of an actual normalized rdbms schema for the data that has both some polymorphism and some hetereogeneity. Some to compare are jsonb_accessor, store_attribute, and store_model. There are some other gems in this “space” of ActiveRecord attribute json serialization, with different fits for different use cases, created either before or after I created attr_json - but none provide quite this combination of features - or, I think, have architectures that make this combination feasible (I could be wrong!). # => will correctly return changes in terms of models themselves My_model.embedded_lang_and_val.lang = "de"












Rails postgres json query