Posted in Thousand separator and Number formating
What about using the rails attirbutes API for this problem: https://api.rubyonrails.org/classes/ActiveRecord/Attributes/ClassMethods.html? As of 2022-10-03 - there is a money example there (just search for: "Creating Custom Types").
Is it any different from submitting a form with a date input, and then magically getting a date time object back when using an active record object?
post_params(:created_at) # => some string post.created_at # => DateTime object
car.price = "$ 100,000,000" # a string car.price # => 10e8 # wow: we get it turned into a number, automatically!
Posted in Docker Basics for Rails Discussion
Sweet thanks for the tutorial.
Does anyone know how to deploy AN UPDATE to your rails app: for example, I've made some bug fixes.
I want to deploy these change to an already running docker container hosted on a Digital Ocean droplet.
Posted in How to Remove Unused CSS Classes from Tailwind CSS, Boostrap, and more with PurgeCSS Discussion
Would anyone know how to do this for esbuild?
This looks like Rails UJS born-again: add in a simple html attribute and BOOM: you get all this functionality for free with minimal effort. I would also add that if this approach is combined with a stimulus controller: and you can load and initialize vue components via AJAX, or turbo_frames, or even turbo streams. best bit.
Posted in Hotwire Modal Forms Discussion
yeah easily possible, i've managed to implement a hello world in this.
the trick is to have the new_room (or new chat/tweet or whatever your model is) OUTSIDE the modal form, so that when it is cancelled, you can still access a completely new form by hitting that button again.
the form is fetching using the turbo frame, and you simply use a stimulus controller to initialize it, and you can when you disconnect the controller simply hide it. It's simple enough and works like a....something that works really well.
Chris' code did not work for me.
This is what worked for me, given I am using webpacker:
Enjoy! And I hope that helps.
Posted in In-App Messages Between Users Discussion
Would you know if one can make Mailboxer work with Action text?
Nice find! Thanks for pointing it out. It's probably enough to sway me against using apartment.
WARNING RE: Multiple schemas
For those implementing a multiple schema approach - where each customer / client / project etc. has their own schema, it is not without its problems. Consider this warning here - if you plan on using Heroku: https://devcenter.heroku.com/articles/heroku-postgresql#multiple-schemas . Granted, this is a problem that you will likely WANT to have (i.e. this means that your SAAS will have taken off into the stratosphere, if you have 50+ or more customer accounts), but it is a warning that is worth giving some pause for consideration.
Memory Bloat, Migration Problems
Tenancy by schema might be very good and quick for a small number of clients, but it seems like once you start scaling, you may run into troubles. Brad Robertson suggests are saying you may run into client memory bloat (because active record caches all tables in all schemas), so you'd get 500 mb memory bloat right off the bat. Robertson also cites anecdotal opinions that it's costing a lot more to house a database using the schema approach.
This is something that I have not looked at, at details - i don't have concrete numbers, or reasons: wondering if anyone has any thoughts on this?
(btw Chris -- thank you for your generous tutorials / time.)