Skip to content

Instantly share code, notes, and snippets.

View xdougx's full-sized avatar

Douglas Rossignolli xdougx

View GitHub Profile
# Depende da gem exceptions-resource, só procurar no meu git que você encontra
module Statusable
extend ActiveSupport::Concern
included do
available_statuses.each do |status|
scope status, -> { where(status: status) }
end
end
class ApplicationController < ActionController::Base
layout 'application'
end
class CategoriesController < ApplicationController
# app/views/categories/show.html.erb
def show
@category = Category.find(params[:id])
end
end
source 'https://rubygems.org'
gem 'rails', '4.2.5'
gem 'pg'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'bcrypt'
gem 'awesome_print'
gem 'mini_magick'
gem 'exceptions-resource', github: 'xdougx/exceptions-resource', require: 'exceptions'
module Import
class Base
attr_accessor :type, :path, :file, :file_type
def initialize(params)
self.type = params[:type]
self.file = params[:file]
self.file_type = params[:file_type]
self.path = File.join(Rails.root, "public", self.file.original_filename)
end