OOZOU
ติดต่อเรา
Back to TILToday I Learned

ruby on rails

22 notes on ruby on rails from the OOZOU team.

all topicsshell 30ruby on rails 22ruby 12macos 10vim 7figma 4cli 3javascript 3heroku 1elixir 1
ruby on rails10 กุมภาพันธ์ 2565

Use Pundit Policies to manage permitted parameters, defaults and per action

To manage permitted params you can add permitted\attributes and permitted\attributes\for\#{action} in your policies e.g.

ruby on rails31 มกราคม 2565

Use `requestSubmit` for form submits with Turbo

Turbo listens to submit events on form.  Hence, always use requestSubmit to submit  a form using JS.

ruby on rails19 มกราคม 2565

Ignore bundled gems for Rubocop and ESLint in GitHub Actions

Rails projects will often install gems into the vendor directory in GitHub actions so we can cache them for the consecutive runs.

ruby on rails18 เมษายน 2564

Rails 6, Ruby 3, Bootstrap 5 and Hotwire

Extending the blogpost from Bootrails with Hotwire: All the fancy new things (as of when I'm writing this TIL):

ruby on rails27 ตุลาคม 2563

Rails Cache-Control

For enabling setting cache-control headers of static assets and using a CDN on Heroku:

ruby on rails14 ตุลาคม 2563

Fix input on Heroku's rails console

If you end up pasting lots of lines into a rails console on Heroku (or else where), you might get issues with the lines "bleeding" into each other.

ruby on rails14 ตุลาคม 2563

Unique ID for DOM in Rails

Rails has many great view helpers, one of which is dom\id:*

ruby on rails13 ตุลาคม 2563

Add new types to Rails 5 attributes API

The Rails 5 attributes API allows us to build form objects very easily.

ruby on rails13 ตุลาคม 2563

Attaching file to ActiveStorage without HTTP

If you want to attach a file you generated on disk or downloaded from a user-submitted URL, you can do it like this.

ruby on rails13 ตุลาคม 2563

Create a Hash from an Enumerable (Rails 6.0)

New method allowing you to create a Hash from an Enumerable:

ruby on rails13 ตุลาคม 2563

Create idempotent migrations

When you want to write destructive migrations please use if\exists: true when you’re trying to remove a table and check for a table existence when you want to add or remove a column…

ruby on rails13 ตุลาคม 2563

How to find god objects in your project (Rails)

Go to your project root and cd into app/models (using CLI obviously) then run wc -lw \ | sort -u*

ruby on rails13 ตุลาคม 2563

HTML forms that submit to another action

I've known for a long time that you can submit values with submit buttons so you can track which button was used to submit the form e.g.

ruby on rails13 ตุลาคม 2563

If you want to override previously set order

If you want to override previously set order (even through default\_scope), use reorder() instead.

ruby on rails13 ตุลาคม 2563

Limited has_many associations

Limited has_many associations

ruby on rails13 ตุลาคม 2563

List your model names

NOTE: RUBYOPT=-W0 avoids verbosity when running rails command which suppresses warnnings.

ruby on rails13 ตุลาคม 2563

Postgres Functions & Non-sargable Queries

Using postgres functions inside a where clause can make a query non-sargable.

ruby on rails13 ตุลาคม 2563

PostgreSQL UPDATE Join

This query shows how to use the PostgreSQL UPDATE join syntax to update data in a table based on values in another table. for example;

ruby on rails13 ตุลาคม 2563

Scope or scope in Rails

scope :human, -> { user.or(author) } scope :terminator, -> { admin.or(robot) } `

ruby on rails13 ตุลาคม 2563

Show TODO and other notes in your Rails app

Did you know you can show all TODOs/OPTIMIZE/FIXME in your rails app with rails notes?

ruby on rails13 ตุลาคม 2563

Tag rails logs with useful information

Just learned about tagged logging in rails. Did you know you can tag a log by using

ruby on rails13 ตุลาคม 2563

Use minItems/maxItems in collection JSON schemas

To make your collection JSON schemas more reilable use minItems and maxItems so that you can trust your API.

มีโปรเจกต์ในใจ?

เรายินดีรับฟังสิ่งที่คุณกำลังสร้าง

เริ่มต้นสนทนาhello@oozou.com
OOZOU Logo

กรุงเทพฯ · สิงคโปร์ · ฮ่องกง

X
Facebook
Instagram
LinkedIn

บริการ

  • พัฒนาเว็บ
  • AI และ Generative AI
  • พัฒนาแอปมือถือ
  • การวิเคราะห์และวิศวกรรมข้อมูล
  • ออกแบบ UI/UX และผลิตภัณฑ์
  • การเปลี่ยนแปลงทางดิจิทัล

บริษัท

  • เกี่ยวกับเรา
  • ร่วมงานกับเรา
  • บล็อก
  • เอกสารวิชาการ
  • กรณีศึกษา
  • Today I Learned
  • ติดต่อเรา

เพิ่มเติม

  • อุตสาหกรรม
  • ขอใบเสนอราคา
  • เครือข่ายพันธมิตร
© 2026 OOZOU สงวนลิขสิทธิ์
นโยบายความเป็นส่วนตัวจรรยาบรรณนโยบาย ABAC