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 AddAvatarColumnsToUser < ActiveRecord::Migration | |
def self.up | |
change_table :users do |t| | |
t.has_attached_file :avatar | |
end | |
end | |
def self.down | |
drop_attached_file :users, :avatar | |
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
module DateTimeComposer | |
module ActiveRecordExtensions | |
module ClassMethods | |
def compound_datetime(*attrs) | |
define_compounds(attrs) | |
end | |
def define_compounds(attrs) | |
attrs.each do |attr| | |
class_eval <<-METHODS |
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
worker_processes 3; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
passenger_root /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.7; | |
passenger_ruby /usr/local/bin/ruby; |
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
#pseudo codigo em topic_manager | |
def add_post(forem_user,post_attributes) | |
@post = @topic.posts.build(post_attributes) | |
@post.user = forem_user | |
@post.save | |
end | |
class PostsController < Forem::ApplicationController |
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
# COMMENT OF SCRIPT HERE | |
# you can make as many tabs as you wish... | |
# tab names are actually arbitrary at this point too. | |
before do | |
run "cd ~/griffti/apps/multiconstrutora" | |
end | |
tab "rails server" do |
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
#definição | |
module RepositorioRelatorios | |
extend self | |
def adicionar(relatorio) | |
@relatorios ||= [] | |
@relatorios.push relatorio | |
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
class ResumosFinanceirosController < ApplicationController | |
before_filter do | |
@consulta_previa = ConsultaPrevia.find(params[:consulta_previa_id]) | |
end | |
def edit | |
@investimentos = Investimentos.new(@consulta_previa.empreendimento) | |
@fontes = Fontes.new(@consulta_previa.empreendimento) | |
@resumo_financeiro = @consulta_previa.empreendimento.resumo_financeiro |
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 PacientesController < ApplicationController | |
before_action :protected_show, only: [:show] | |
def show | |
@paciente = Paciente.find(params[:id]) | |
end | |
private | |
def protected_show | |
unless clinica_logada.pacientes.where(id: params[:id]).any? |
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
# controller metodo index: | |
def index | |
@consultorios = BuscadorConsultorio.new(params).filtrar | |
end | |
# novo objeto de busca | |
class BuscadorConsultorio | |
def new(opcoes_busca, buscado_padrao = Setor::Consultorio) |
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 CustomerSerializer < ActiveModel::Serializer | |
attributes :id, :name, :email | |
end | |
class SchedulingSerializer < ActiveModel::Serializer | |
attributes :id, :beauty_salon_id, :schedule_id, :customer_id, | |
:date_scheduling, :hour, :beauty_salon | |
has_many :services |
OlderNewer