We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Enhancing Ecto Schemas with the :source Option
66
clicks
Source: johnelmlabs.com
John Curran's article explains a technique to make Ecto schema fields more self-explanatory by adding a question mark to boolean field names. He explains that directly adding a question mark to a field name would result in an error, as Ecto maps these field names directly to database columns. By using the :source option in the Ecto schema definition, developers can maintain clear naming conventions in their Elixir code, while ensuring the correct database mappings. Furthermore, the :source option can help perform column renaming safely, without the need for risky database migrations.
Related posts
© HashMerge 2024