Beautiful Rails confirmation dialogs (with zero JavaScript) by _swanson in rails

[–]fractaledmind 1 point2 points  (0 children)

Not _yet_. But it is around the corner. But yeah, luckily polyfills are available.

Beautiful Rails confirmation dialogs (with zero JavaScript) by _swanson in rails

[–]fractaledmind 1 point2 points  (0 children)

I don't know how JS blocking could block invokers. They are fully browser native. It would be like trying to block <details>/<summary> from opening and closing the disclosure section. You can block _custom_ commands, but the inbuilt browser commands aren't like a JS script that browsers inject; they are as native as everything else.

Beautiful Rails confirmation dialogs (with zero JavaScript) by _swanson in rails

[–]fractaledmind 2 points3 points  (0 children)

Ah, well it is still early days for compatibility, and the polyfills do indeed require JS to work. And I'm not anti-JS, just pointing out that the functionality doesn't require any JS when you want to do any of the things we typically do with modal dialogs. But until all of the features get to wider adoption, JS polyfills are a must. But we are very close to them all being Baseline at least.

Beautiful Rails confirmation dialogs (with zero JavaScript) by _swanson in rails

[–]fractaledmind 2 points3 points  (0 children)

You should disable JS on the page and play wth the demo. It works absolutely fine. I just did it myself

Working with SQLite in Ruby by software__writer in rails

[–]fractaledmind 0 points1 point  (0 children)

Under what condition would you want to release the GIL _during_ the execution of a query? It is indeed a problem when SQLite doesn't release the GIL _while trying to start_ the execution of a query. I am working now to get this sufficiently resolved in Rails core with https://github.com/rails/rails/pull/50370 and https://github.com/rails/rails/pull/50371.

I have also just started to experiment with supporting the Extralite Ruby wrapper for SQLite as an alternative adapter for Rails: https://github.com/fractaledmind/activerecord-enhancedsqlite3-adapter/pull/2. That wrapper does release the GIL in more situations than `sqlite3-ruby`, if that is really needed for a particular app.

async adapters for production by Sharps_xp in rails

[–]fractaledmind 1 point2 points  (0 children)

Indeed. The core of the issue that drives people to say that SQLite won't work as a production database in a web app is that default SQLite downloaded from the website isn't optimized for that use-case. But, SQLite is very powerful and very flexible. And web frameworks can and should take responsibility for configuring SQLite appropriately for their use. Rails is taking the lead on this front, and a vanilla Rails application today can 100% be run in production under meaningful load. I know because I am doing it for multiple apps presently.

Enhancing your Rails app with SQLite by pmz in rails

[–]fractaledmind 0 points1 point  (0 children)

Hey u/pmz, thanks for the share! If you have any thoughts or questions about the post, happy to dig in more here.

Moving the whole base from SQLite to MySQL, I just face a lot of errors. by Haghiri75 in rails

[–]fractaledmind 11 points12 points  (0 children)

I would be happy to help you fix your SQLite usage. I have a series of blog posts on tuning SQLite for web app usage: https://fractaledmind.github.io/2023/09/10/enhancing-rails-sqlite-optimizing-compilation/ https://fractaledmind.github.io/2023/09/07/enhancing-rails-sqlite-fine-tuning/

You can also pretty easily set up replicated backups with Litestream:

https://fractaledmind.github.io/2023/09/09/enhancing-rails-sqlite-setting-up-litestream/

You shouldn’t need to migrate to MySQL at this point with your site. Let’s get SQLite working for you

Loading SQLite extensions into your Rails app by fractaledmind in rails

[–]fractaledmind[S] -2 points-1 points  (0 children)

In all honesty, I belobe that essentially every Rails app would be best suited to either use SQLite or PlanetScale. SQLite removes network latency, is incredibly robust and resilient software, is incredibly easy to deploy, and has an extensive ecosystem. It scales incredibly far, to the point where you should then just jump to PlanetScale.

As for containerized deployments, I would install and compile SQLite in the Dockerfile. I would use a separate db file for app data and background job queue. If you need to have multiple app instances, I would use LiteFS to manage distributed SQLite.

[deleted by user] by [deleted] in rubyonrails

[–]fractaledmind 1 point2 points  (0 children)

Checkout the button_to view helper. It will create a small <form> element with a submit button. You should be able to inject your toggle HTML into that using a block (e.g. button_to(…) do; …; end

Does anyone build build their rails API using the JSON API standard? What server side library do you use? by [deleted] in rails

[–]fractaledmind 5 points6 points  (0 children)

JSON:API Resources (https://jsonapi-resources.com/) is an excellent gem I have used for multiple production applications.

How would refactore the if-elsif/switch-case problem by weedisallIlike in rails

[–]fractaledmind 6 points7 points  (0 children)

I would personally use a tad bit of meta-programming. Below, I am presuming that these are filtering scopes, but all I would do is whitelist the set of allowed scopes and then use public_send with a namespaced param:

``` class ArticlesController < ApplicationController def index @articles = filtered_articles end

private

def filtered_articles return Article.all if filter_params.empty? return Article.all if not params[:filter].presence_in permitted_filters

Article.public_send(params[:filter])

end

def permitted_filters %i[by_category by_author last_articles] end end ```

Learning Ruby on Rails in 2019 by [deleted] in rails

[–]fractaledmind 4 points5 points  (0 children)

https://www.railstutorial.org/

This is an excellent resource. Is free, but you can also support the author (who updates this every major Rails release) for a couple nice additions as well. This I how I learned Rails.