This file contains 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} |
This file contains 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 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 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 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
%table | |
%thead | |
%tr | |
%th Number | |
%th Created At | |
%th Text | |
%th | |
%th | |
%th |
This file contains 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
{ | |
"excludeFiles": ["node_modules/**", "bower_components/**"], | |
"requireCurlyBraces": [ | |
"if", | |
"else", | |
"for", | |
"while", | |
"do", | |
"try", |
This file contains 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
{ | |
"bitwise": true, | |
"camelcase": false, | |
"curly": true, | |
"eqeqeq": true, | |
"es3": false, | |
"forin": true, | |
"freeze": true, | |
"immed": true, | |
"indent": 4, |
This file contains 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
git branch | grep -v "master" | xargs git branch -D |
This file contains 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
module Api | |
class CharacterManager | |
API_CONFIG = YAML.load_file("#{Rails.root.to_s}/config/marvel_configs.yml")["marvel_api"] | |
def initialize options={} | |
@ts = "#{API_CONFIG['ts']}" | |
@api_key = "#{API_CONFIG['api_key']}" | |
@hash = "#{API_CONFIG['secret_hash']}" | |
@limit = "#{API_CONFIG['limit']}" |
This file contains 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 Marvel::CharactersController < ApplicationController | |
before_action :authenticate_user! | |
def index | |
@characters = Character.paginate(page: params[:page], per_page: 10) | |
get_all_characters unless @characters.present? | |
end | |
def show | |
@character = get_character |
OlderNewer