This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Product < ActiveRecord::Base | |
| validates :name, :estoque_id | |
| has_many :log | |
| end | |
| class User < ActiveRecord::Base | |
| validates :name | |
| has_many :log | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Produto < ActiveRecord::Base | |
| # id, nome, quantidade_em_estoque | |
| validates :id, :nome, :quantidade_em_estoque | |
| end | |
| ##### | |
| class EstoqueController < ApplicationController | |
| # current_user_id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Produto < ActiveRecord::Base | |
| # id, nome, quantidade_em_estoque | |
| validates :id, :nome, :quantidade_em_estoque | |
| end | |
| ##### | |
| class EstoqueController < ApplicationController | |
| current_user |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class User < ActiveRecord::Base | |
| scope :email_exist, -> { where.not(email: nil) } | |
| attr_accessor :password | |
| validates :nome, presence: true, length: { maximum: 50 } | |
| before_save { self.email = email.downcase } | |
| validates :email, presence: true, format: {with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i, on: :create}, uniqueness: {case_sensitive: false} |
NewerOlder