Skip to content

Instantly share code, notes, and snippets.

View ralfting's full-sized avatar
🏠
Working from home

Ralph Effting ralfting

🏠
Working from home
  • Finbits
  • Palhoça - SC
View GitHub Profile
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web servers
# and those relying on copy on write to perform better.
# Rake tasks automatically ignore this option for performance.
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
Company Load (0.1ms) SELECT `companies`.* FROM `companies` WHERE `companies`.`email` = 'dinam@dinam.com.br' ORDER BY `companies`.`id` ASC LIMIT 1
Started GET "/" for 127.0.0.1 at 2015-03-25 14:30:24 -0300
ActiveRecord::SchemaMigration Load (0.1ms) SELECT `schema_migrations`.* FROM `schema_migrations`
Processing by HomeController#index as HTML
Completed 401 Unauthorized in 15ms
Started GET "/" for 127.0.0.1 at 2015-03-25 14:30:25 -0300
class User < ActiveRecord::Base
belongs_to :company
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and :omniauthable
devise :database_authenticatable,
:recoverable, :rememberable, :trackable, :validatable, :confirmable
# Create a password reset token for this user, saves it encrypted and returns the raw token text
def setup_password_reset
@ralfting
ralfting / gist:98db2afe7a94c5001975
Created March 26, 2015 01:41
companier_controller.rb
class CompaniesController < ApplicationController
before_action :set_company, :only => [:show, :update, :add]
def show
authorize! 'read_company', @company
render :json => @company, :methods => [:factor_ids, :daily_limit, :company_types]
end
def factors
if current_user.is_superuser
@factors = Company.all.joins('JOIN current_accounts ON companies.id = current_accounts.client_id').where('current_accounts.company_type = ?', 'factor')
<!DOCTYPE html>
<html lang="en" ng-app>
<head>
<meta charset="UTF-8">
<title>List</title>
</head>
<body>
<!-- code here -->
@ralfting
ralfting / gist:cb45d3dec2a1891b9e07
Last active August 29, 2015 14:17
Controller.js
var app = angular.module('myApp', []);
app.controller('mainCtrl', function(){
// code controller
});
<!DOCTYPE html>
<html lang="en" ng-app="myApp">
<head>
<meta charset="UTF-8">
<title>List ToDo</title>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
</head>
<body>