Skip to content

Instantly share code, notes, and snippets.

@ricsdeol
Last active May 7, 2016 17:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ricsdeol/5e09415f12152b1ba2648e7f9d2844fb to your computer and use it in GitHub Desktop.
Save ricsdeol/5e09415f12152b1ba2648e7f9d2844fb to your computer and use it in GitHub Desktop.
AMS v9.X with knock
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module SmartflowApi
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
config.time_zone = 'Brasilia'
config.active_record.default_timezone = :local
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
config.i18n.default_locale = :'pt-BR'
# Do not swallow errors in after_commit/after_rollback callbacks.
config.active_record.raise_in_transactional_callbacks = true
config.api_only = false
config.active_job.queue_adapter = :sidekiq
console do
ActiveRecord::Base.connection
end
config.generators do |g|
g.test_framework :minitest, spec: true
end
config.middleware.insert_before 0, 'Rack::Cors', debug: true,
logger: (-> { Rails.logger }) do
allow do
origins '*'
resource '*',
headers: :any,
methods: [:get, :post, :delete, :put, :patch, :options, :head],
max_age: 0
end
end
end
end
active_model_serializers (0.9.5)
activemodel (>= 3.2)
knock (1.4.2)
bcrypt (~> 3.1)
jwt (~> 1.5)
rails (>= 4.2)
#this exception only occurs in different development environment
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.
config.eager_load = true
# Full error reports are disabled and caching is turned on.
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Enable Rack::Cache to put a simple HTTP cache in front of your application
# Add `rack-cache` to your Gemfile before enabling this.
# For large-scale production use, consider using a caching reverse proxy like
# NGINX, varnish or squid.
# config.action_dispatch.rack_cache = true
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.serve_static_files = false
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :sass
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = true
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = :debug
# Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ]
# Use a different logger for distributed setups.
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com'
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
config.action_mailer.default_url_options = { host: 'xxxxxx' }
config.action_mailer.asset_host = 'xxxx'
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default charset: 'utf-8'
config.action_mailer.smtp_settings = {
address: ENV['SANDBOX_MAILGUN_IP'],
port: 587,
domain: ENV['SANDBOX_MAILGUN_SMTP_HOST'],
user_name: ENV['SANDBOX_MAILGUN_SMTP_LOGIN'],
password: ENV['SANDBOX_MAILGUN_SMTP_PASSWORD'],
authentication: 'plain',
enable_starttls_auto: true }
end
, [2016-05-05T18:21:14.069295 #27773] DEBUG -- : Incoming Headers:
Origin: chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop
Access-Control-Request-Method:
Access-Control-Request-Headers:
I, [2016-05-05T18:21:14.069901 #27773] INFO -- : Started POST "/v1/knock/auth_token" for 127.0.0.1 at 2016-05-05 18:21:14 -0300
I, [2016-05-05T18:21:16.327323 #27773] INFO -- : Processing by Knock::AuthTokenController#create as */*
I, [2016-05-05T18:21:16.327433 #27773] INFO -- : Parameters: {"auth"=>{"email"=>"sistemas@solvian.com", "password"=>"[FILTERED]"}}
D, [2016-05-05T18:21:17.021950 #27773] DEBUG -- : User Load (171.5ms) SELECT "users".* FROM "users" WHERE "users"."email" = $1 LIMIT 1 [["email", "sistemas@solvian.com"]]
D, [2016-05-05T18:21:17.733822 #27773] DEBUG -- : Access Load (171.0ms) SELECT "accesses".* FROM "accesses" WHERE "accesses"."user_id" IN (1)
D, [2016-05-05T18:21:17.997072 #27773] DEBUG -- : CACHE (0.0ms) SELECT "users".* FROM "users" WHERE "users"."email" = $1 LIMIT 1 [["email", "sistemas@solvian.com"]]
D, [2016-05-05T18:21:17.998116 #27773] DEBUG -- : CACHE (0.0ms) SELECT "accesses".* FROM "accesses" WHERE "accesses"."user_id" IN (1)
I, [2016-05-05T18:21:17.999446 #27773] INFO -- : Completed 500 Internal Server Error in 1672ms (ActiveRecord: 1383.0ms)
F, [2016-05-05T18:21:18.002362 #27773] FATAL -- :
ArgumentError (wrong number of arguments (2 for 0)):
active_model_serializers (0.9.5) lib/action_controller/serialization.rb:95:in `initialize'
active_model_serializers (0.9.5) lib/action_controller/serialization.rb:95:in `new'
active_model_serializers (0.9.5) lib/action_controller/serialization.rb:95:in `build_json_serializer'
active_model_serializers (0.9.5) lib/action_controller/serialization.rb:50:in `block (2 levels) in <module:Serialization>'
actionpack (4.2.6) lib/action_controller/metal/renderers.rb:45:in `block in _render_to_body_with_renderer'
/home/ricardoleite/.rvm/rubies/ruby-2.1.7/lib/ruby/2.1.0/set.rb:263:in `each_key'
/home/ricardoleite/.rvm/rubies/ruby-2.1.7/lib/ruby/2.1.0/set.rb:263:in `each'
actionpack (4.2.6) lib/action_controller/metal/renderers.rb:41:in `_render_to_body_with_renderer'
actionpack (4.2.6) lib/action_controller/metal/renderers.rb:37:in `render_to_body'
actionpack (4.2.6) lib/abstract_controller/rendering.rb:25:in `render'
actionpack (4.2.6) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (4.2.6) lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
activesupport (4.2.6) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
/home/ricardoleite/.rvm/rubies/ruby-2.1.7/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
activesupport (4.2.6) lib/active_support/core_ext/benchmark.rb:12:in `ms'
actionpack (4.2.6) lib/action_controller/metal/instrumentation.rb:44:in `block in render'
actionpack (4.2.6) lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime'
activerecord (4.2.6) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
actionpack (4.2.6) lib/action_controller/metal/instrumentation.rb:43:in `render'
knock (1.4.2) app/controllers/knock/auth_token_controller.rb:8:in `create'
actionpack (4.2.6) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.2.6) lib/abstract_controller/base.rb:198:in `process_action'
actionpack (4.2.6) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.2.6) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (4.2.6) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.6) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.6) lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
activesupport (4.2.6) lib/active_support/callbacks.rb:505:in `call'
activesupport (4.2.6) lib/active_support/callbacks.rb:505:in `call'
activesupport (4.2.6) lib/active_support/callbacks.rb:92:in `__run_callbacks__'
activesupport (4.2.6) lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'
activesupport (4.2.6) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.6) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (4.2.6) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.2.6) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (4.2.6) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.6) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.6) lib/active_support/notifications.rb:164:in `instrument'
actionpack (4.2.6) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.2.6) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
activerecord (4.2.6) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.2.6) lib/abstract_controller/base.rb:137:in `process'
actionview (4.2.6) lib/action_view/rendering.rb:30:in `process'
actionpack (4.2.6) lib/action_controller/metal.rb:196:in `dispatch'
actionpack (4.2.6) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.2.6) lib/action_controller/metal.rb:237:in `block in action'
actionpack (4.2.6) lib/action_dispatch/routing/route_set.rb:74:in `call'
actionpack (4.2.6) lib/action_dispatch/routing/route_set.rb:74:in `dispatch'
actionpack (4.2.6) lib/action_dispatch/routing/route_set.rb:43:in `serve'
actionpack (4.2.6) lib/action_dispatch/journey/router.rb:43:in `block in serve'
actionpack (4.2.6) lib/action_dispatch/journey/router.rb:30:in `each'
actionpack (4.2.6) lib/action_dispatch/journey/router.rb:30:in `serve'
actionpack (4.2.6) lib/action_dispatch/routing/route_set.rb:817:in `call'
railties (4.2.6) lib/rails/engine.rb:518:in `call'
railties (4.2.6) lib/rails/railtie.rb:194:in `public_send'
railties (4.2.6) lib/rails/railtie.rb:194:in `method_missing'
actionpack (4.2.6) lib/action_dispatch/routing/mapper.rb:51:in `serve'
actionpack (4.2.6) lib/action_dispatch/journey/router.rb:43:in `block in serve'
actionpack (4.2.6) lib/action_dispatch/journey/router.rb:30:in `each'
actionpack (4.2.6) lib/action_dispatch/journey/router.rb:30:in `serve'
actionpack (4.2.6) lib/action_dispatch/routing/route_set.rb:817:in `call'
newrelic_rpm (3.15.1.316) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
newrelic_rpm (3.15.1.316) lib/new_relic/rack/agent_hooks.rb:30:in `traced_call'
newrelic_rpm (3.15.1.316) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
newrelic_rpm (3.15.1.316) lib/new_relic/rack/browser_monitoring.rb:32:in `traced_call'
newrelic_rpm (3.15.1.316) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (1.6.4) lib/rack/etag.rb:24:in `call'
newrelic_rpm (3.15.1.316) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (1.6.4) lib/rack/conditionalget.rb:38:in `call'
newrelic_rpm (3.15.1.316) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (1.6.4) lib/rack/head.rb:13:in `call'
newrelic_rpm (3.15.1.316) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (4.2.6) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
newrelic_rpm (3.15.1.316) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (4.2.6) lib/action_dispatch/middleware/flash.rb:260:in `call'
newrelic_rpm (3.15.1.316) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (1.6.4) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.6.4) lib/rack/session/abstract/id.rb:220:in `call'
newrelic_rpm (3.15.1.316) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (4.2.6) lib/action_dispatch/middleware/cookies.rb:560:in `call'
newrelic_rpm (3.15.1.316) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
activerecord (4.2.6) lib/active_record/query_cache.rb:36:in `call'
newrelic_rpm (3.15.1.316) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
activerecord (4.2.6) lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'
newrelic_rpm (3.15.1.316) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (4.2.6) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.6) lib/active_support/callbacks.rb:88:in `__run_callbacks__'
activesupport (4.2.6) lib/active_support/callbacks.rb:778:in `_run_call_callbacks'
activesupport (4.2.6) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.6) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
newrelic_rpm (3.15.1.316) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (4.2.6) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
newrelic_rpm (3.15.1.316) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (4.2.6) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
newrelic_rpm (3.15.1.316) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (4.2.6) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
newrelic_rpm (3.15.1.316) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
railties (4.2.6) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.6) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.6) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.6) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.6) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.6) lib/rails/rack/logger.rb:20:in `call'
newrelic_rpm (3.15.1.316) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
actionpack (4.2.6) lib/action_dispatch/middleware/request_id.rb:21:in `call'
newrelic_rpm (3.15.1.316) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
newrelic_rpm (3.15.1.316) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (1.6.4) lib/rack/runtime.rb:18:in `call'
newrelic_rpm (3.15.1.316) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
activesupport (4.2.6) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
newrelic_rpm (3.15.1.316) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack-cors (0.4.0) lib/rack/cors.rb:80:in `call'
newrelic_rpm (3.15.1.316) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
railties (4.2.6) lib/rails/engine.rb:518:in `call'
railties (4.2.6) lib/rails/application.rb:165:in `call'
newrelic_rpm (3.15.1.316) lib/new_relic/agent/instrumentation/middleware_tracing.rb:96:in `call'
rack (1.6.4) lib/rack/content_length.rb:15:in `call'
thin (1.6.4) lib/thin/connection.rb:86:in `block in pre_process'
thin (1.6.4) lib/thin/connection.rb:84:in `catch'
thin (1.6.4) lib/thin/connection.rb:84:in `pre_process'
thin (1.6.4) lib/thin/connection.rb:53:in `process'
thin (1.6.4) lib/thin/connection.rb:39:in `receive_data'
eventmachine (1.2.0.1) lib/eventmachine.rb:194:in `run_machine'
eventmachine (1.2.0.1) lib/eventmachine.rb:194:in `run'
thin (1.6.4) lib/thin/backends/base.rb:73:in `start'
thin (1.6.4) lib/thin/server.rb:162:in `start'
rack (1.6.4) lib/rack/handler/thin.rb:19:in `run'
rack (1.6.4) lib/rack/server.rb:286:in `start'
railties (4.2.6) lib/rails/commands/server.rb:80:in `start'
railties (4.2.6) lib/rails/commands/commands_tasks.rb:80:in `block in server'
railties (4.2.6) lib/rails/commands/commands_tasks.rb:75:in `tap'
railties (4.2.6) lib/rails/commands/commands_tasks.rb:75:in `server'
railties (4.2.6) lib/rails/commands/commands_tasks.rb:39:in `run_command!'
railties (4.2.6) lib/rails/commands.rb:17:in `<top (required)>'
bin/rails:8:in `require'
bin/rails:8:in `<top (required)>'
spring (1.6.4) lib/spring/client/rails.rb:28:in `load'
spring (1.6.4) lib/spring/client/rails.rb:28:in `call'
spring (1.6.4) lib/spring/client/command.rb:7:in `call'
spring (1.6.4) lib/spring/client.rb:28:in `run'
spring (1.6.4) bin/spring:49:in `<top (required)>'
spring (1.6.4) lib/spring/binstub.rb:11:in `load'
spring (1.6.4) lib/spring/binstub.rb:11:in `<top (required)>'
/home/ricardoleite/.rvm/rubies/ruby-2.1.7/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/home/ricardoleite/.rvm/rubies/ruby-2.1.7/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
bin/spring:13:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment