Hello! Good afternoon. I'm an information systems student and I'm doing a small project where I need to put a form to fetch the Product template objects that exist in the database.
Product template:
class Produto < ApplicationRecord
be...
I have 4 tables with the following relationships:
Products have N Variations
Sizes have N Variations
Colors have N Variations
Variations belongs to Products, Sizes and Colors
The structure of the tables looks like this:
Variatio...
I made the select gender field this way:
model:
enum sexo: [:feminino, :masculino, :desconhecido]
def self.sexes_for_select
sexos.keys.map{ |x| [x.humanize, x] }
end
form:
<%= f.select :sexo, Pessoa.sexes_for_sele...
I created two models in the Rails application, and made their relationship through the declaration in the classes and in the database as well.
I added the configuration to activate the nested resources in the routes file, the routes were created...
I'm starting in the area, I have the following scenario in my back end done in rails:
I want to implement a parent class:
Equipment:
ID PK
Brand
...
And some child classes
Printer:
ID_EQUIPMENT PK and FK
...
Computers:
ID_EQUIPMENT P...
Hello! I have the following code snippet from a controller called ProductsController:
def index
@produtos = Produto.all
end
def gerarlog
@produtos.each do |produto|
File.open('produtosBD.yml', 'a') do |arquivo|
arq...
Hello! I have the following code generated by Scaffold:
<p id="notice"><%= notice %></p>
<h1>Produtos</h1>
<table class="table table-striped" id="tabelaProdutos">
<thead>
<tr>
<t...
Good afternoon guys, I'm having a hard time understanding how Ruby works with csv, I need to read a file and import the data from that file into a variable
I have a file named die.txt so
Id | Nome | Endereco
1 | Renato | Alameda das magnol...