my rails server seems like it is logging everything twice, not sure what is going on here, what should I do to investigate this ?
my gemfile
source 'https://rubygems.org'
ruby '2.1.0'
gem 'rails', '4.0.1'
gem 'haml-rails'
gem 'pg', '~> 0.17.1'
gem 'redis'
gem 'redis-namespace'
gem 'thin', '~> 1.6.1'
gem 'rabl'
gem 'underscore-rails'
#assets
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'foundation-rails'
gem 'font-awesome-rails'
#javascript
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'jbuilder', '~> 1.2'
gem 'angularjs-rails', '~> 1.2.7'
gem 'ngmin-rails', '~> 0.4.0'
#user auth
gem 'devise', '3.0.0'
gem 'omniauth'
gem 'omniauth-twitter'
gem 'uuidtools'
#misc tools
gem 'twitter'
#heroku
gem 'rails_12factor'
group :development, :test do
gem 'capybara-webkit', github: 'thoughtbot/capybara-webkit', branch: 'master'
gem 'rspec-rails', '~> 2.14.1'
gem 'factory_girl_rails', '4.2.1'
gem 'mocha', '~> 1.0.0'
gem 'pry'
gem 'pry-debugger'
gem 'quiet_assets'
gem 'parallel_tests'
gem 'zeus-parallel_tests'
gem 'guard-rspec'
gem 'rb-fsevent'
end
group :development do
gem 'guard-livereload'
gem 'rack-livereload'
gem 'better_errors'
gem 'terminal-notifier-guard'
end
group :test do
gem 'launchy', '>= 2.1.2'
gem 'capybara', '>= 1.1.3'
gem 'database_cleaner', '~> 1.2.0'
gem 'zeus', :require => false
gem 'shoulda-matchers'
gem 'pdf-inspector'
gem 'selenium-webdriver'
gem "mock_redis", "~> 0.11.0"
end
In my case this was caused by the rails_12factor gem. This gem adds the rails_stdout_logging gem which sends the logs to standard output. This can be useful in a production environment but not in development when Rails already does it by default.
https://github.com/heroku/rails_12factor#rails-4-logging
The solution is to only add this gem in production:
gem 'rails_12factor', group: :production
Have a look at this issue
Try adding the following code to you config/application.rb
if Rails.env.development?
# Don't log to STDOUT, by default rails s will handle it
config.logger = Logger.new('/dev/null')
else
# Don't log to file, sending everything to unicorn file.
config.logger = Logger.new(STDOUT)
end
Do you have your logger set to anything in either config/application.rb or config/environments/development.rb?
If nothing, try adding this line to config/environments/development.rb:
config.logger = Logger.new('/dev/null')
I had success with this in development.rb:
config.logger = ActiveSupport::Logger.new('/dev/null')
Related
Im trying to add ActiveAdmin to a (massive) application. I follow all the steps here:
https://activeadmin.info/0-installation.html#setting-up-active-admin
The installation process was fine. My problem here is with the assets. When I tried to run:
http://localhost:3000/admin/login/
I got an error:
Showing /Users/fmaymone/.rvm/gems/ruby-2.3.0/gems/activeadmin-
1.1.0/app/views/layouts/active_admin_logged_out.html.erb where line #9 raised:
couldn't find file 'jquery3' with type 'application/javascript'
Checked in these paths:
This application is kind of tricky. Its running webpack together with the rails server. I never worked with this kind of configuration.
Theres not a application.js where I can add a require//
I tried doing a npm i jquery too.
Should I put directly inside the webpack the jquery.js?
This is my GemFile
gem 'rails', '4.2.2'
# This needs to be declared earlier than alphabetical order to load properly re: the app.
gem 'paperclip', '~> 5.0.0'
gem 'activeadmin', '~> 1.4', '>= 1.4.3'
gem 'actionpack-action_caching'
gem 'active_model-errors_details'
gem 'active_model_serializers', '~> 0.10.0'
gem 'activerecord-rescue_from_duplicate'
gem 'activerecord-sqlserver-adapter', '~> 4.2.0'
gem 'addressable'
gem 'ahoy_email'
gem 'ahoy_matey'
gem 'airbrake', '~>6.2'
gem 'ajax-datatables-rails'
gem 'asset_sync'
gem 'attachment_on_the_fly'
gem 'aws-sdk', '~> 2.0'
gem 'axlsx', '2.1.0.pre'
gem 'axlsx_rails'
gem 'blazer'
gem 'bootstrap-generators', '~> 3.3.4'
gem 'bootstrap-sass', '~> 3.3.4'
gem 'browser-timezone-rails'
gem 'chronic'
gem 'coffee-rails', '~> 4.1.0'
gem 'countries'
gem 'daemons'
gem 'data_migrate', '~>5.0'
gem 'delayed_job', '~>4.1.5'
gem 'delayed_job_active_record'
gem 'devise'
gem 'dotenv-rails', :groups => [:development, :test]
gem 'double-bag-ftps'
gem 'faraday'
gem 'fog-aws'
gem 'font-awesome-sass', '~> 4.7.0'
gem 'geocoder', '~> 1.5.1'
gem 'hashdiff'
gem 'hashformer'
gem 'hashie'
gem 'htmlentities'
gem 'httparty'
gem 'hubspot-ruby', '~> 0.4.0'
gem 'jbuilder', '~> 2.0'
gem 'jira-ruby'
gem 'jquery-datatables-rails', github: "rweng/jquery-datatables-rails", branch: "master"
gem 'jquery-rails'
gem 'json-schema'
gem 'kaminari'
gem 'libv8', '6.7.288.46.1'
gem 'mailgun-ruby', '~>1.1.6'
gem 'marketingcloudsdk', '~> 1.0'
gem 'mini_racer', '0.2.3', platforms: :ruby
gem 'mjml-rails'
gem 'money-rails', '~>1'
gem 'multipart-post'
gem 'net-scp'
gem 'newrelic_rpm'
gem 'oj'
gem 'oj_mimic_json'
gem 'pg'
gem 'progress_bar'
gem 'rack-cors', :require => 'rack/cors'
gem 'rails-observers', '~> 0.1.2'
gem 'rails_admin', '~> 1.2.0'
gem 'ransack'
gem 'react_on_rails', '~>6'
gem 'rest-client'
gem 'retriable', '~> 3.1'
gem 'roo', '~> 2.7.0'
gem 'roo-xls'
gem 'rubyzip', '~> 1.1.0'
gem 'sass-rails', '~> 5.0.6'
gem 'savon', '~> 2.2.0'
gem 'schema_plus_pg_indexes'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'seed_dump'
gem 'simple_form'
gem 'slither', :git => 'https://github.com/Programatica/slither.git'
gem 'stripe'
gem 'sunspot_rails', '~> 2.2.5'
gem 'sunspot_solr', '~> 2.2.5'# optional pre-packaged Solr distribution for use in development
gem 'taxjar-ruby', require: 'taxjar'
gem 'thin'
gem 'tiny_tds'
gem 'twitter-typeahead-rails'
gem 'uglifier', '>= 1.3.0'
gem 'validates_timeliness', '~> 4.0'
gem 'wannabe_bool'
gem 'whenever', :require => false
gem 'wisper', '~> 2.0.0'
gem 'wisper-rspec', require: false, groups: [:development, :test]
gem 'workflow'
gem "graphql"
gem "graphql-errors"
gem "graphql-batch"
gem "graphql-guard"
gem "nokogiri"
group :production, :staging do
gem 'sprockets-redirect'
end
group :test do
gem 'shoulda-matchers', '~> 3.1', '>= 3.1.1'
gem 'shoulda-callback-matchers', '~> 1.1.1'
gem 'simplecov', :require => false
gem "vcr"
end
group :development do
gem 'web-console', '~> 2.0'
end
group :development, :test do
gem "pry"
gem 'pry-byebug'
gem "guard-rspec"
gem 'spring-commands-rspec'
gem 'graphiql-rails'
gem "puma"
gem 'byebug'
gem 'spring'
gem 'faker'
gem 'rspec'
gem 'rspec-rails'
gem 'rspec_candy'
gem 'factory_bot_rails'
gem 'capybara'
gem 'database_cleaner'
gem 'ffaker'
gem 'to_factory'
gem 'timecop'
gem 'test_after_commit', :group => :test
gem 'webmock'
end
Thanks
You are probably using an old version of jquery-rails which turn out to raise an error. jquery3 is required in the base javascript file, and the support for it was not available before the rails 4.2.0 version in jquery-rails gem. Therefore, I recommend you to check the versions of jquery-rails with rails and activeadmin gem.
I'm using Rails-Admin for the dashboard of Rails app. But on dashboard, the icons are all same - white square.
Screenshot for Broken Icons:
Here is the gemfile
source 'http://rubygems.org'
gem 'rails', '4.1.1'
gem 'slim-rails', '~> 2.1.0'
gem 'devise', '~> 3.2.4'
gem 'devise-i18n'
gem 'configatron', '2.13.0'
gem 'navigation_link_to', '0.0.2'
gem 'cyrax', '0.7.4'
gem 'dotenv-rails'
gem 'simple_form', '3.0.2'
# emails styles
gem 'roadie', '2.4.3'
# assets
gem 'sass-rails', '~> 4.0.3'
gem 'uglifier', '~> 2.5.0'
gem 'coffee-rails', '~> 4.0.1'
gem 'therubyracer', platforms: :ruby, require: 'v8'
gem 'droidcss'
gem 'jquery-rails'
gem 'bootstrap-sass'
# unicorn
gem 'unicorn'
gem 'jbuilder'
# mongo
gem 'mongoid', '~> 4.0.0'
gem 'mongoid-grid_fs'
gem 'fog', '~> 1.27', require: 'fog/aws/storage'
gem 'carrierwave-mongoid', require: 'carrierwave/mongoid'
gem 'mongoid-geospatial'
# gem 'rmagick', require: false
gem 'mini_magick'
gem 'carrierwave-video'
gem 'public_activity'
gem 'mongoid_slug'
gem 'mongoid_search'
gem 'mongoid_paranoia', github: 'simi/mongoid_paranoia'
# aerospike
gem 'aerospike'
# documentation
gem 'apipie-rails', github: 'Apipie/apipie-rails'
gem 'maruku'
# other gems
gem 'inherited_resources'
gem 'rails_admin', github: 'sferik/rails_admin'
gem 'enumerize'
gem 'sidekiq'
gem 'pundit'
# ios gem
gem 'houston'
gem 'whenever'
# gem 'quartz', github: 'jeizsm/quartz'
gem 'twilio-ruby'
# mixpanel
gem 'mixpanel-ruby'
group :development do
gem 'capistrano', '2.15.5', require: false
gem 'capistrano-sidekiq', github: 'seuros/capistrano-sidekiq'
gem 'letter_opener'
gem 'quiet_assets', '1.0.2'
gem 'thin', '1.6.2'
gem 'guard-rubocop'
end
group :test do
gem 'spring-commands-rspec'
gem 'database_cleaner', '1.2.0'
gem 'factory_girl_rails', '4.4.1'
gem 'capybara', '2.3.0'
gem 'email_spec', '1.5.0'
gem 'turnip', '1.2.1'
end
group :test, :development do
gem 'mocha', '1.0.0', require: 'mocha/api'
gem 'spring'
gem 'rspec-rails', '~> 3.0.0'
gem 'guard-rspec', require: false
gem 'shoulda', '3.5.0'
gem 'byebug'
gem 'pry-byebug'
gem 'pry-rails'
end
Is there any mistake while using the rails admin or other gems?
Any suggestion would be helpful!
I think you need to use font-awesome gem. I had the same issue before.
Rails admin uses an old version of fontawesome. Download the zip file here: http://fortawesome.github.io/Font-Awesome/3.2.1/assets/font-awesome.zip
Then put the following files into the /public/assets directory of your rails project, from the /font directory in the zip file:
fontawesome-webfont.eot
fontawesome-webfont.svg
fontawesome-webfont.ttf
fontawesome-webfont.woff
FontAwesome.otf
I tried to deploy the ruby on rails project from a github folder. However, I got such an error when I run cap production deploy
/home/deploy/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
'require': cannot load such file -- capistrano/cli (LoadError) from /home/deploy/.rbenv/
versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in 'require'
from /usr/bin/cap:3:in '<main>'
I have deploy.rb starting with:
# config valid only for Capistrano 3.1
lock '3.1.0'
And I installed Capistrano v.3.1 with the following command-line:
gem install capistrano -v 3.1.0
Anybody has ideas why I still got an error?
Attached Gemfile:
source 'https://rubygems.org'
gem 'rails', '4.1.0'
# Frontend
gem 'simple_form'
gem 'nested_form', github: 'ryanb/nested_form'
gem 'turbolinks'
gem 'bootstrap-sass', '~> 3.2.0'
gem 'kaminari'
# Javascript
gem 'gon'
gem 'angularjs-rails'
gem 'selectize-rails'
gem 'js-routes'
# Backend
gem 'pg'
gem 'mongoid', github: 'mongoid/mongoid'
gem 'mongoid_geospatial'
gem "active_model_serializers"
gem 'devise'
gem 'state_machine'
gem "rolify"
gem "pundit"
gem 'enumerize'
gem 'simple-rss'
gem 'tweetstream'
gem 'swagger-docs', path: "vendor/gems/swagger-docs-0.1.5"
gem 'wkhtmltopdf-binary'
gem 'wicked_pdf'
gem 'paper_trail', '~> 3.0.3'
# Temporary
gem 'faker'
gem 'factory_girl_rails'
# Asset gems
gem 'haml-rails'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'sass-rails', '~> 4.0.3'
gem 'compass-rails'
group :development do
gem 'spring' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'switch_user'
gem 'better_errors'
gem 'binding_of_caller'
gem 'sextant'
gem 'guard-livereload', require: false
gem 'capistrano', '~> 3.1.0'
gem 'capistrano-bundler', '~> 1.1.2'
gem 'capistrano-rails', '~> 1.1.1'
gem 'capistrano-rbenv', github: "capistrano/rbenv"
end
group :test do
gem 'rspec-rails'
gem 'spring-commands-rspec'
gem 'guard-rspec'
gem 'fuubar'
gem 'capybara'
gem 'capybara-webkit'
gem 'capybara-email'
gem 'capybara-screenshot'
gem 'database_cleaner'
end
group :test, :darwin do
gem 'rb-fsevent'# if `uname` =~ /Darwin/
end
group :development, :test do
gem 'pry-rails'
gem 'pry-remote'
end
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
Thanks!
I am using doorkeeper for OAuth functionality on my ruby on rails application. Suddenly doorkeeper became unable to create token in production mode for some Doorkeeper::Application (i have three Doorkeeper::Application settings) without writing in the production log file, but yesterday it worked normally.
Every time on POST "/oauth/token" doorkeeper returns 500 page for this Doorkeeper::Application, but 201 for another one.
When I recreated Doorkeeper::Application configuration in database without changing parameters, doorkeeper began to work normally with this new record.
I am using postgres with doorkeeper v 0.6.7.
Here is my gemfile:
source 'https://rubygems.org'
def darwin_only(require_as)
RUBY_PLATFORM.include?('darwin') && require_as
end
def linux_only(require_as)
RUBY_PLATFORM.include?('linux') && require_as
end
gem 'rails', '3.2.16'
gem 'jquery-rails'
gem 'pg'
gem 'slim-rails'
gem 'inherited_resources'
gem 'simple_form'
gem 'twitter-bootstrap-rails'
gem 'airbrake', '3.1.2'
gem 'devise'
gem 'httparty'
gem 'ledermann-rails-settings', :require => 'rails-settings'
gem 'carrierwave', git: 'git://github.com/jnicklas/carrierwave.git', ref: '809e86b697'
gem 'mini_magick'
gem 'ruby-progressbar'
gem 'doorkeeper', '~> 0.6.7'
gem 'jsonify-rails'
gem 'less-rails'
gem 'therubyracer', '0.12.1'
gem 'cancan'
gem 'push-core', git: 'git://github.com/tompesman/push-core.git', ref: '980ddc107f'
gem 'push-apns'
gem 'push-gcm'
gem 'delayed_job_active_record'
gem 'daemons'
gem 'recaptcha', require: 'recaptcha/rails'
gem 'validates_timeliness'
gem 'paper_trail'
gem 'oj'
gem 'kaminari'
gem 'newrelic_rpm'
gem 'russian'
gem 'nested_form', '~> 0.3.2'
gem 'select2-rails'
gem 'jquery-ui-rails'
gem 'bourbon'
gem 'axlsx_rails'
gem 'sanitize'
gem 'gilenson'
gem 'ace-rails-ap'
gem 'activerecord-postgres-hstore'
gem 'geocoder'
gem 'rest-client'
gem 'figaro'
gem 'rails-erd'
gem 'acts_as_singleton'
gem 'carrierwave-processing'
group :development do
gem 'thin'
gem 'capistrano'
gem 'capistrano-ext'
gem 'rvm-capistrano'
gem 'yard'
gem 'quiet_assets'
gem 'pry-rails'
gem 'pry-plus'
gem 'ZenTest', '4.9.5'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
gem 'jquery-datatables-rails', git: 'git://github.com/rweng/jquery-datatables-rails.git'
end
group :test, :development do
gem 'rspec-rails', '~> 2.0'
gem 'spork-rails'
# Guard
gem 'guard-rspec'
gem 'guard-spork'
# File changes
gem 'rb-fsevent', require: darwin_only('rb-fsevent')
gem 'rb-inotify', require: linux_only('rb-inotify')
# Notifications
gem 'terminal-notifier-guard', require: darwin_only('terminal-notifier-guard')
end
group :test do
gem 'factory_girl_rails'
gem 'shoulda-matchers'
gem 'autotest-rails'
gem 'ffaker'
gem 'webmock'
gem 'vcr'
gem 'capybara'
gem 'json_spec'
gem 'simplecov', require: false
gem 'simplecov-sublime-ruby-coverage', require: false
gem 'test_after_commit'
end
What can be wrong with doorkeeper?
My Heroku deploy is failing on the Running: rake assets:precompile step with the follow:
Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 'sqlite3'` to your Gemfile.
My Gemfile has 'sqlite3' only in the development group, as you can see:
source 'https://rubygems.org'
ruby '2.0.0'
gem 'rails', '4.0.1'
gem 'sass-rails', '~> 4.0.0'
gem "compass-rails", "~> 2.0.alpha.0"
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.2'
gem 'devise'
gem 'figaro'
gem 'haml-rails'
gem 'sendgrid'
gem 'simple_form'
gem 'omniauth-twitter'
gem 'omniauth-facebook'
gem "cancan", :git => "git://github.com/ryanb/cancan.git", :branch => "2.0"
gem 'roadie', '2.4.2'
group :development do
gem 'better_errors'
gem 'binding_of_caller', :platforms=>[:mri_19, :mri_20, :rbx]
gem 'guard-bundler'
gem 'guard-rails'
gem 'guard-rspec'
gem 'guard-livereload'
gem 'html2haml'
gem 'quiet_assets'
gem 'rails_layout'
gem 'rb-fchange', :require=>false
gem 'rb-fsevent', :require=>false
gem 'rb-inotify', :require=>false
gem 'debugger'
end
group :development, :test do
gem 'factory_girl_rails'
gem 'rspec-rails'
gem 'zeus'
gem 'sqlite3'
end
group :test do
gem 'capybara'
gem 'capybara-webkit'
gem 'database_cleaner', '1.0.1'
gem 'email_spec'
end
group :production do
gem 'unicorn'
gem 'passenger'
gem 'rails_12factor'
end
Additionally, I am using the rails_12factor gem and user-env-compile thing... neither helped with the error. I've also added RACK_ENV=production and RAILS_ENV=production config vars to the Heroku environment, to be safe.
Seems like it Heroku is firing up the development environment when precompiling. Any ideas why?
On Heroku, I've never gotten away without having pg in my production group.
group :production do
gem 'pg'
gem 'rails_12factor'
end
Assuming you're using that database in prod, of course.