Luis Gustavo Ganimiluisgustavoganimi.hashnode.dev·Nov 25, 2024Optimizing Database Performance in Ruby on RailsAs applications grow in scale, database performance often becomes a critical bottleneck. Ruby on Rails, with its ActiveRecord ORM, offers powerful tools to simplify database interactions. However, without proper optimizations, these conveniences can ...database
Julián Pinzón Eslavapinzonjulian.hashnode.dev·Nov 7, 2024Customising Single Table Inheritance mapping in Active RecordA few weeks ago I was working on modelling set of relationships between very similar concepts so I evaluated the different alternatives that Active Records provides for this; Abstract classes, Single Table Inheritance (STI) and Delegated Types. I end...151 readsRuby
Renan Portotota1099.hashnode.dev·Oct 24, 2024Rails - Como transformar seus modelos para JSONVamos pensar no cenário em que eu possuo uma Model Customer e eu pretendo retorna-lá como JSON em alguma parte da minha aplicação: class Customer include ActiveModel::Model attr_accessor :id, :name validates :id, presence: true, numericality: ...RailsRails
Lucian Ghindaallaboutcoding.ghinda.com·Jun 28, 2023Ruby's range literals and their effect on Rails Active Record queriesThe following Active Record query: User.where(created_at: 1.day.ago...Time.current).to_sql will generate this SQL: SELECT "users".* FROM "users" WHERE "users"."created_at" >= '2023-06-21 06:38:26.330063' AND "users"."created_at" < '2023-0...3 likes·1.6K readsRuby
Dhaval Singhwww.dsdev.in·Sep 6, 2021TIL #1 : How to pluck jsonb fileds in RailsIf you have a jsonb field in your Active record object and you want some nested value you can use pluck Example: Lets say your Users model has a jsonb attribuite metadata which has a nested key location which in turn has city you can get the value of...42 readsPostgreSQL