Creează un cont pentru a te abona la acest blog și a-i urmări articolele pe pagina Lectură.
-
Solid Queue stores recurring tasks in the solid_queue_recurring_tasks table.
-
Counter caches are a handy way to maintain and optimize the performance of counting associated records in Rails.
-
ActiveRecord::Base.connection.execute Make use of ActiveRecord::Base.connection.execute to execute raw SQL queries in rails. result = ActiveRecord::Base.connection.execute("SELECT * FROM users") ActiveRecord::Base.connection.execute with complex query Wh…
-
Drop a Table Drop users table $ bin/rails generate migration DropUsers Generates the following migration: # db/migrate/20240818074017_drop_users.rb class DropUsers < ActiveRecord::Migration[7.1] def change end end Add the following code to the migra…
-
Rails 7.2 introduced devcontainer support to make it easier to set up a development environment for a Rails application.
-
Installation Add or uncomment the following line in your Gemfile: gem "image_processing", ">= 1.2" Now based on the cloud storage service you want to use, add the respective gem: gem "aws-sdk-s3", require: false # For Amazon S3 gem "azure-storage-blob",…
-
Array#shuffle method The shuffle method will shuffle the elements in an array and returns a new array. array = [1, 2, 3, 4, 5] array.shuffle # => [3, 4, 2, 5, 1] array # => [1, 2, 3, 4, 5] Array#shuffle!
-
While we can always change the database adapter in the database.yml file manually, it’s always better to use the built in command to do it for us.
-
We use rake tasks for automating various repetitive tasks.
-
Rails provides a straightforward way to check if an index exists using the index_exists?