Stateless Forms with the Rails Attributes API: No Active Record? No Problem!
01-Sep-2022 919
One of the ironies of working with Ruby on Rails is that making a feature do less often results in more work. For a great example of this, consider the ingredients that go into a standard Rails form: route, controller, ERB template, Active Record model. If you do things “The Rails Way”, we could have everything working in just a few minutes.Now take that form and swap out the Active Record models in favor of plain ol' Ruby objects. Suddenly nothing works! (That’s what we get for going off the Rails, I guess.)I recently had to work through this myself, but arrived at a surprisingly simple solution enabled by the sorta-public-but-still-kinda-private Attributes API.
Stateless Forms with the Rails Attributes API: No Active Record? No Problem! #ruby #rubydeveloper #rubyonrails #Stateless #Forms #Rails #Attributes #Active #Record? #Problem! #active #api: #record? https://rubyonrails.ba/link/stateless-forms-with-the-rails-attributes-api-no-active-record-no-problem