github.com

Ambitious Query Indexer is a Rails plugin to identify database indexes that are missing. Rather than looking at tables and guessing what needs indexing, it will locate and run as...

github.com

Rails plugin which adds a convenient way to override attr_accessible protection.... You can mark certain attributes as trusted for different roles...

github.com

Asset Fingerprint Plugin for Ruby on Rails - allows you to use md5 or timestamps in query string or in asset filenames as suggested by Google Page Speed

youtube.com

Rails 3.1 preview at the end...

makandracards.com

...config/initializers/searchkick.rb (or wherever you have configured your Searchkick settings) add: SEARCHKICK_CLIENT_TYPE = case Rails.env when 'production', 'staging', 'development', 'test' :elasticsearch else :opensearch end Searchkick.client_type = ENV.fetch('SEARCHKICK_CLIENT_TYPE...

...SEARCHKICK_CLIENT_TYPE).to_sym ENV['OPENSEARCH_URL'] ||= case Rails.env when 'production' OPENSEARCH_PRODUCTION_SERVER when 'staging' OPENSEARCH_STAGING_SERVER else 'http://opensearch:9200' # docker container name end

If you would like to use language specific layout (e.g. background-images) in your applications stylesheets you can achieve this...

makandracards.com

Rails applications and ruby gems should have a README that gives the reader a quick overview of the project. Its size will vary as projects differ in complexity, but there...

...be written atop the class file. Structure I suggest the following outline for a Rails project's README, using the very readable Markdown language: # App title Describe the whole project...

...answers: an overview first, then narrower questions. You can trace a request through a Rails app with the agent's help, from the route to the response.

"Explain the conventions used in this project that differ from a default Rails app." "Give me a glossary of project-specific terms." Then dig into specifics:

makandra dev
stackoverflow.com

...your working directory that you cannot remove by either checkout, reset [--hard], stash, probably Rails' Spring is the culprit and not Bundler itself. Fix spring stop The author of the...

For some reason you want to define a find condition in array form. And in that condition both column name...

...at the same time have a .where on an included table, two things happen: Rails tries to load all involved records in a huge single query spanning multiple database tables...

activity.users.ids # here happens the unexpected # => [4] Workarounds Preload separately In newer Rails versions you should prefer to use joins and then preload if necessary (which will trigger a...

github.com

...for old IEs. Unfortunately, their auto-loading mechanism may not work properly on your Rails application due to the asset pipeline. They use FileAPI, so you could just include it...

makandra dev

...you. It likely will. The sandbox has one caveat: When Claude Code detects a Rails application, the config directory becomes read-only for Claude's BashTool by default and there...

...database.yml to look roughly like this: default: &default adapter: postgresql encoding: unicode pool: <%= ENV.fetch('RAILS_MAX_THREADS') { 5 } %> development: <<: *default <%= 'host: localhost' unless ENV['SANDBOX_RUNTIME'] %> database: your_app_development...

...model validation that restricts its length. There are two motivations for this: In modern Rails, database types :string and :text no longer have a relevant size limit. Without a validation...

...malicious user can quickly exhaust the hard drive of your database server. In legacy Rails (or database schemas migrated from legacy Rails), database types :string and :text had a database...

...part is a bit lengthy, but it allows you to debug strange bugs with Rails autoloading the wrong constants. Due to the constant lookup rules above, Rails sometimes guesses wrong...

...in development and production, but the problem exist for both environment. Development During development, Rails unloads all classes after every request. This way code changes take effect immediately, without requiring...

makandra dev

When a Rails controller action should handle both HTML and JSON responses, do not use request.xhr? to decide that. Use respond_to. I've too often seen code like this...

api.rubyonrails.org

...load associated records if you know you need to access them later on. The Rails docs say: Eager loading is supported with polymorphic associations. This is true, but has some...

...and include their current versions' primary media... Page.includes(:current_version => :primary_medium).to_a ... Rails will produce 4 queries: Page Load (0.7ms) SELECT "pages".* FROM "pages" PageVersion Load...

github.com

gem 'super_diff' Require it in your spec_helper.rb require 'super_diff/rspec' # For Rails applications you can replace this with 'super_diff/rspec-rails' Customize colors in spec/support/super_diff.rb SuperDiff.configure do |config...

...contain exactly "XXX" ActiveRecord::Base is monkey patched by super_diff/rspec-rails (includes rspec and rails) super_diff/rails (includes active_record and active_support) super_diff/active_record This means that you have...

Recent rails security updates have shown that people make incorrect assumptions about the possible contents of the params hash. Just don't make any! Treat it as what it is...

.../pages/edit?foo --> params == {:foo => nil} /pages/edit?foo[] --> params == {:foo => [nil]} # at least in older rails 3 and in rails 2.x Be especially wary about stuff like User.find_by_password...

robots.thoughtbot.com

Arel is a library that was introduced in Rails 3 for use in constructing SQL queries. Every time you pass a hash to where, it goes through Arel eventually. Rails...

apidock.com

If you have an integer and want to use it to represent an element's position (like "1st" for 1...

When you try to remove a non-existing index using remove_index, the migration will incorrectly pass without an error...

makandra dev
github.com

Shortener is a Rails Engine Gem that makes it easy to create and interpret shortened URLs on your own domain from within your Rails application. Once installed Shortener will generate...

If you turn on stylesheet caching, it might happen that stylesheets from different locations with different relative pathes will be...