...even though the image data was stripped. # spec/support/vcr.rb VCR.configure do |config| config.cassette_library_dir = Rails.root.join('spec', 'vcr') config.hook_into :webmock config.filter_sensitive_data(' ') do Base64.strict_encode64("#{Rails.application.credentials.ollama_basic_auth_user...

...Rails.application.credentials.ollama_basic_auth_password!}") end config.ignore_localhost = true scrub_base64_images = lambda do |body| return body if body.blank? json = JSON.parse(body) if json.is_a?(Hash) && json['messages'].is_a?(Array...

alfajango.com

We can now plug into every facet of the Rails jQuery UJS adapter, binding to custom events, and even customizing internal functions, without hacking or monkey-patching the rails.js file...

alfajango.com

Thanks to habits engrained by Rails 2’s link_to_remote and remote_form_for, we expect that Rails 3 would also handle the AJAX response for our remote links...

emphaticsolutions.com

In a great post about named routes in Rails, path vs. url, Viget Labs ponders which variant is best used. Most often we use foo_path, which when used in...

...Rails URL helpers will generate a relative path, where foo_url generates a full URL. In most cases the path makes most sense, but not always...

blog.peepcode.com

The Rails router has been written and rewritten at least four times2, including a recent rewrite for the upcoming Rails 3. The syntax is now more concise. But never mind...

blog.innerewut.de

...ve been made aware of people inside US Government organizations using my Ruby on Rails Security presentation as an excuse to limit Ruby on Rails adoption and projects inside those...

relishapp.com

...are verified. Note that this is enabled by default when you are using rspec-rails along with verifying doubles. So if you really need to verify some dynamically defined methods...

...changelog_path = File.expand_path('../CHANGELOG.md', __dir__) Ruby < 2.0 changelog_path = File.expand_path('../../CHANGELOG.md', __FILE__) Rails changelog_path = Rails.root.join('CHANGELOG.md...

...consume GBs of memory bringing down our servers. The solution Just use .preload instead. Rails will use separate queries to preload the data. This cannot lead to a cross product...

options: { search: 'window.toString() === \'[object GjsGlobal]\'', replace: 'window.toString() === \'[object Window]\'' } }] }) Fix for ESBuild / jsbundling-rails Add the package esbuild-plugin-text-replace to your package.json. Now add the following plugin...

...only list versions that are allowed by your Gemfile requirements (e.g. does not show rails update to 6 if your Gemfile has the line gem 'rails', '~>5.2'). I also experienced...

makandra dev
railsforzombies.org

Learning Rails for the first time should be fun, and Rails for Zombies allows you to get your feet wet without having to worry about configuration. You'll watch five...

...videos, each followed by exercises where you'll be programming Rails in your browser...

...you UTC objects whose to_s(:db) may not convert properly. Legacy behavior in Rails 2.3 It's been briefly mentioned in the random list of ActiveSupport goodies, but please...

...remember to always use Time.current instead of Time.now, etc. Why? Because of the way Rails and MySQL deal with time zones you would need to take care to use Time.zone.now...

Rails 8 provides a new way of doing things after the current transaction, without defining a model "global" after_commit callback. def do_something update_column(:foo, "bar")

...update_column(:foo, "bar") ActiveRecord::Base.current_transaction.after_commit { send_email(foo: "bar") } ActiveRecord::Base.current_transaction.after_rollback { Rails.logger.warn("rollback") } # after_rollback is also supported end If you call current_transaction.after_commit in a nested...

If you get an error message like that you are missing the Aspell files a specific language:

sudo gem install rails --version="=1.2.3" rails _1.2.3_ new-project-folder

robots.thoughtbot.com

Declare an enum attribute where the values map to integers in the database, but can be queried by name.

everydayrails.com

I recently had a need to demonstrate a data-heavy application to potential customers. Demonstrating the application with bogus numbers...

makandra dev

...query -> query embedding -> kNN search -> ranked pages | +--------------------------------------------------------------------+ See: How to add RAG to your Rails application Full-text keyword search (BM25) Full-text search splits each document into tokens (words...

...calls in local and CI tests. See also How to add RAG to your Rails application: vector search end-to-end. You don't need a vector database to build...

...accidentally translates the query. It might be a good idea to cache the result (Rails.cache) for some time so a page reload doesn't re-call the LLM. Authorize the...

...to Hybrid search for the trade-offs, or How to add RAG to your Rails application to get started on the vector branch...

justinfrench.com

If you’re testing the behavior of deprecated code in your Ruby project, the warning messages littered throughout your spec...

gist.github.com

The differences are subtle. You probably want to use Time, except when you want to use DateTime. See the attached...

...Always convert to a symbol, otherwise you'll have all kinds of fun. Newer rails / activerecord (at least 5.2) will throw an association names must be a Symbol (ArgumentError) error...

...few examples, where you configure some library via a block. One example is the Rails configuration: Rails.application.configure do |config| config.enable_reloading = false end This card describes a simple example on...

...You can use ActiveSupport::Configurable instead of the Configuration class. When you are using Rails with Zeitwerk and the code for e.g. FooClient lives in a folder, that is loaded...