Explore tweets tagged as #activemodel
@RubyCademy
RubyCademy
9 months
Have you ever heard of the Static Model pattern? 🤩.#rubyonrails #activemodel
Tweet media one
3
10
105
@RubyCademy
RubyCademy
11 months
✨ RAILS PRO TIPS ✨. Effortlessly group validation errors by attribute with ActiveModel::Errors#group_by_attribute ✨💫. #rubyonrails #activerecord #activemodel
Tweet media one
0
9
38
@RubyCademy
RubyCademy
5 months
Rails is just too good. 💚. Define a custom ActiveModel type, register it, and boom: automatic and reusable currency normalizer! 💥 😊. #rubyonrails
Tweet media one
4
12
139
@RubyCademy
RubyCademy
9 months
Take advantage of `ActiveModel::Attribute` and the `:immutable_string` cast type to ensure your string attributes are automatically frozen ✨💫. #rubyonrails #activemodel
Tweet media one
2
2
28
@rails
Ruby on Rails
1 year
The #ActiveModel documentation has just been reviewed and edited and the PR is now up for community review. Fair warning: this is a lengthy guide, but if you have time and want to help, please take a look:
Tweet media one
0
13
102
@RubyCademy
RubyCademy
1 year
✨ RAILS PRO TIPS ✨. Take advantage of ActiveModel::API to implement models similar to ActiveRecord::Base ✨💫. PS: Note that ActiveModel::Model is nothing but an empty shell that includes ActiveModel::API.
Tweet media one
0
9
48
@rails
Ruby on Rails
5 months
This Week in Rails: An improvement to routing performance, the execution wrapper now catches all exceptions, ActiveModel type values are now mutable by default, PostgreSQL adapter improvements, and smarter query handling! Read about all these changes in this week's edition:
Tweet media one
2
6
51
@joelquen
Joël Quenneville
2 months
Did you know ActiveModel supports objects with composite primary keys? I used this to model events grouped by a few properties. Groups were a concept in my UI but not in the database. Just as easy as ActiveRecord!.
Tweet media one
1
4
11
@FORSBERGtwo
Björn Forsberg / FORSBERG+two
2 years
Today I used Serializers in ActiveModel for the first time. Love learning new stuff, especially when it’s getting to know the framework itself better (#rubyonrails) 🤓
Tweet media one
0
0
7
@HiSaeloun
Saeloun
5 months
Rails Introduces ActiveModel::Attributes::Normalization
Tweet media one
2
5
24
@RubyCademy
RubyCademy
7 months
Combine the power of: . ➡️ `ActiveModel::Attributes#attributes`.➡️ and `ActionView::Helpers::DebugHelper#debug`. to render readable YAML for all attributes in your object, directly in your views! 🤩. #rubyonrails #actionviews
Tweet media one
Tweet media two
2
4
39
@jasonnochlin
Jason Nochlin
1 year
I need to serialize an array of ActiveModel::Model instances and store them in an ActiveRecord model attribute. I made several attempts to achieve this with the `serialize` AR method, and ended up needing to write a custom coder for this use case. What do you think of this
Tweet media one
2
0
8
@RubyCademy
RubyCademy
1 year
✨ RAILS PRO TIPS ✨. Take advantage of ActiveModel::Name#human to transform model names into a more human format, using I18n ✨💫. By default, it will underscore and then humanize the class name. #rubyonrails #activemodel
Tweet media one
2
2
33
@RubyCademy
RubyCademy
9 months
Here's an easy way to enforce uniqueness within a specific scope. 🤩. For example, a lesson name can be made unique within each course. #rubyonrails #activemodel #activerecord
Tweet media one
2
3
29
@RubyCademy
RubyCademy
10 months
Yet another shorthand that makes Rails awesome! 🤩. PS: Note that ActiveModel::Model is nothing but an empty shell that includes ActiveModel::API. #rubyonrails #activemodel #activerecord
Tweet media one
0
1
39
@jkostolansky
Juraj Kostolanský
1 year
If you're using ActiveModel::Dirty in after_commit callbacks, make sure you're not saving the record multiple times in the same transaction. It'll report only the attributes that were changed before the LAST save. Or avoid using these helpers in commit callbacks.
Tweet media one
0
0
3
@joemasilotti
Joe Masilotti
2 years
Following @_swanson's lead, more real code Friday!. This is the registration flow for the RailsDevs referral program. I'm using ActiveModel::Model for a form - no database table needed. `valid?` ensures a checked agreement. `validates :agreement` adds an attr_accessor, too.
Tweet media one
0
2
16
@RubyCademy
RubyCademy
8 months
I love how Rails makes it effortless to humanize model names with `ActiveModel::Name#human`, converting them into a more readable format using I18n!  🤩. #rubyonrails #activemodel
Tweet media one
2
1
17
@aviflombaum
Avi Flombaum
2 years
Very exciting. Custom form builder to create ActiveModel backed forms for shadcn on Rails.
Tweet media one
0
0
5