Skip to content

Instantly share code, notes, and snippets.

View Frank004's full-sized avatar

francisco Quinones Frank004

  • HB Quality Ware
  • Puerto Rico
View GitHub Profile
<head>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= stylesheet_link_tag "application", :media => "all", 'data-turbolinks-track' => true %>
</head>
@Frank004
Frank004 / apartment.rb
Last active January 4, 2017 16:47
Error with connection with rails, apartment, pg and sidekiq/redis
# You can have Apartment route to the appropriate Tenant by adding some Rack middleware.
# Apartment can support many different "Elevators" that can take care of this routing to your data.
# Require whichever Elevator you're using below or none if you have a custom one.
#
# require 'apartment/elevators/generic'
# require 'apartment/elevators/domain'
require 'apartment/elevators/subdomain'
# Apartment Configuration
#
Apartment.configure do |config|
Apartment::TenantNotFound
10:29:28 redis_s.1 | 74800:M 07 Jun 10:29:28.005 * 100 changes in 300 seconds. Saving...
10:29:28 redis_s.1 | 74800:M 07 Jun 10:29:28.005 * Background saving started by pid 75086
10:29:28 redis_s.1 | 75086:C 07 Jun 10:29:28.008 * DB saved on disk
10:29:28 redis_s.1 | 74800:M 07 Jun 10:29:28.108 * Background saving terminated with success
10:34:08 worker.1 | 2016-06-07T14:34:08.366Z 74801 TID-ouqzhpisc MyWorker JID-6c67cc125750e19e53322044 INFO: start
10:34:08 worker.1 | 2016-06-07T14:34:08.368Z 74801 TID-ouqzhpisc MyWorker JID-6c67cc125750e19e53322044 INFO: fail: 0.003 sec
10:34:08 worker.1 | 2016-06-07T14:34:08.369Z 74801 TID-ouqzhpisc WARN: {"class"=>"MyWorker", "args"=>["companydemo", "juan", 5], "retry"=>true, "queue"=>"default", "jid"=>"6c67cc125750e19e53322044", "created_at"=>1465309377.292077, "apartment"=>"companydemo", "enqueued_at"=>1465310048.364147, "error_message"=>"One of the following schema(s) is invalid: \"companydemo\" \"public\"", "error_class"=>"Apartment::T
@two_week = 14.days.ago.to_date..Time.now.utc.to_date
current_user.glycemiuns.where(['glycemia_date = ?', @two_week]).each do |date|
irb(main):058:0> 14.days.ago.to_date..Time.now.utc.to_date
=> Fri, 20 May 2016..Fri, 03 Jun 2016
json.array!(@task_trans) do |task_tran|
json.extract! task_tran, :name, :id, :description
json.start task_tran.start_date
json.end task_tran.end_date
json.url task_tran_url(task_tran, format: :html)
end
ActionController::RoutingError (No route matches [POST] "/inspection_components/10622"):
12:02:44 log.1 | actionpack (4.2.5) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
12:02:44 log.1 | web-console (2.3.0) lib/web_console/middleware.rb:28:in `block in call'
12:02:44 log.1 | web-console (2.3.0) lib/web_console/middleware.rb:18:in `catch'
12:02:44 log.1 | web-console (2.3.0) lib/web_console/middleware.rb:18:in `call'
12:02:44 log.1 | rack-contrib (1.4.0) lib/rack/contrib/response_headers.rb:17:in `call'
12:02:44 log.1 | meta_request (0.4.0) lib/meta_request/middlewares/headers.rb:16:in `call'
12:02:44 log.1 | actionpack (4.2.5) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
12:02:44 log.1 | railties (4.2.5) lib/rails/rack/logger.rb:38:in `call_app'
12:02:44 log.1 | railties (4.2.5) lib/rails/rack/logger.rb:20:in `block in call'
@p = Project.with_monthly_tasks
@p.map{|p| p.tasks.current_month_task.select(:name,:type_id,:group_id,:est_hrs,:est_mins,:section_id).group_by{ |t| t.section.name}}
require 'ffaker'
FactoryGirl.define do
factory :company do
name "Company Demo"
address {FFaker::Address.street_address}
city "Ponce"
state "PR"
country "PR"
phone {FFaker::PhoneNumberCU.e164_home_work_phone_number}
subdomain 'Companydemo'
def show
@accidents = @employee.accidents.paginate(:page => params[:accidents], :per_page => 5)
@incidents = @employee.incidents.paginate(:page => params[:incidents], :per_page => 5)
@trainings = @employee.trainings.paginate(:page => params[:trainings], :per_page => 5)
end
class ApplicationController < ActionController::Base
before_filter :authenticate_user!
protect_from_forgery with: :exception
before_filter :configure_permitted_parameters, if: :devise_controller?
def after_sign_out_path_for(resource_or_scope)
new_user_session_path
end
#esto lo tengo porque tengo 2 tipos de user que quiero redirigir cuando inicien la sección.