Closed vanderleipinto closed 9 months ago
rails g migration AddCnpjToSuppliers cnpj:string
rails db:migrate
In the file: app/views/suppliers/_form.html.erb
<div> <%= form.label :CNPJ, style: "display: block" %> <%= form.text_field :cnpj %> </div>
In the file app/controllers/suppliers_controller.rb
... # Only allow a list of trusted parameters through. def supplier_params params.require(:supplier).permit(:name, :cnpj) end ...
Add CNPJ to Supplier:
rails g migration AddCnpjToSuppliers cnpj:string
Migrate database.
rails db:migrate
Insert CNPJ field in the supplier form:
In the file: app/views/suppliers/_form.html.erb
Allow the controller to receive CNPJ param.
In the file app/controllers/suppliers_controller.rb