A guide to creating forms in Ruby on Rails 6

At a high level, there are two ways of creating forms in Rails.1) We can create the entire form by hand using HTML just as we would in any static HTML file.2) Alternatively, we can use a powerful form_with helper that makes our lives much easier. This helper can have the following use cases.It can be used to set up a form for a resource that is associated with an Active Record model meaning it has REST routes and also a database model. It can be both for resource creation or update.It can be used to create a form for a resource that doesn't have any Active Record model, meaning it has REST routes but no database model.It can be used for setting up a form having no resource and Active Record model, meaning there are neither REST routes nor any database model. Such a form can also be created by hand as point 1 illustrates but using form_with makes it easier still.Now let's explore form creation in little more detail.
A guide to creating forms in Ruby on Rails 6 #ruby #rubydeveloper #rubyonrails #guide https://rubyonrails.ba/single/a-guide-to-creating-forms-in-ruby-on-rails-6

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles