Articles tagged with 'Rails'
Referencing Stimulus Controllers as ViewComponent Sidecar Files with Propshaft Importmaps
May 15, 2024
AKA: How many Rails buzzwords can I fit in a single blog post title?
Using Local Font Files in the Rails 7.1 Asset Pipeline
Apr 29, 2024
I wanted to play with the new hotness of Rails asset handling in a sideproject, and ran into some fiddliness in getting FontAwesome webfonts to be seen when loading them from an SCSS file. I'm using propshaft and Dart Sass in this app to build my CSS assets, and there wasn't any documentation I could find on how to reference your local font files within your SCSS files.
Using Postgres Enum in Rails ActiveRecord
Oct 16, 2020
In this post, I will provide some code to make working with an Enum data type in Postgres easier within your ActiveRecord models. Skip to the end for the code, or stick around for some verbose pontificating.
Rails Logging to Syslog using Logging gem
Mar 6, 2008
When using a mongrel cluster, you can either log to a separate file for each mongrel instance, or you can log them all to the same file, but on a loaded cluster, there's a good chance your logged lines will get interleaved and be unreadable. Luckily, there's another way. The new replacement for log4r Logging can take care of this. It has a built-in way of not interleaving the lines, but (I think) its using lockfiles to do so, and if so, that's going to be detrimental to performance. The best solution has been around for 25 years, syslog. And with one of the more recent syslog daemons (syslog-ng, or rsyslog), you can set it up to log your mongrel log wherever you like.
Rails tip: Additional content for a layout
Oct 22, 2007
If you need to add additional content to your layout, you can have named content_for blocks. Great for including additional page-specific javascript files.
Rails update_attribute gotcha
Jan 26, 2007
Model#update_attribute(:name, "Rando") does not trigger any validations, even on name and just saves it to the database.