rails app not connecting to redis on heroku (RedisToGo) - ruby-on-rails

am trying to push my rails 4 app on heroku but getting this error:
Error connecting to Redis on 127.0.0.1:6379 (ECONNREFUSED) (Redis::CannotConnectError)
on heroku logs, i have completed the RedisToGo setup as suggested by the heroku devcenter
but nothing happened i think am doing something wrong with RedisToGo URL
redis.rb
uri = URI.parse(ENV["REDIS_URL"] || "redis://redistogo:0deb5da103a95090a365444d016c59a6#angelfish.redistogo.com:9308/" )
$redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
my development.rb
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
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Action Mailer configuration
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :test
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# 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
# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = true
ENV["REDISTOGO_URL"] = 'redis://redistogo:0deb5da103a95090a365444d016c59a6#angelfish.redistogo.com:9308/'
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
# React configurations.
config.react.variant = :development
config.react.addons = true
config.after_initialize do
Bullet.enable = true
Bullet.alert = true
end
end

Related

Postmark mailing on localhost and staging problem

After I configure to use postmark service to post emails I'm facing some troubles with development and staging envs.
Short explanation: portmark is working nice in the below situations with 'ok', and when there is DeserializationError it seems that the active job is failing because it is looking to see if the user id exists on production database.
Development env:
devise mailing -> ActiveJob::DeserializationError
deliver_later -> ActiveJob::DeserializationError
delover_now -> ok
Staging env
devise mailing -> ActiveJob::DeserializationError
deliver_later -> ActiveJob::DeserializationError
delover_now -> ok
production env
devise mailing -> ok
deliver_later -> ok
deliver_now -> ok
Long explanation:
When I'm on these two envs and requests with devise the confirmation instructions, it sends a link to this email with a production url with the token attached to it which points to wrong page.
The most intriguing thing is that after I send an email from development or staging envs console, and I opened up sidekiq dashboard and I found out that when there is no user id on production associated with the id that this email was requested to send (from the other envs), this mailing fails with this message:
Console:
> Rails.env
"development"
> #user.id
22
> UserMailer.welcome(#user).deliver_later
Sidekiq error:
ActiveJob::DeserializationError: Error while trying to deserialize
arguments: Couldn't find User with 'id'=22
Console:
> Rails.env
"staging"
> #user.id
15
> UserMailer.welcome(#user).deliver_later
Sidekiq error:
ActiveJob::DeserializationError: Error while trying to deserialize
arguments: Couldn't find User with 'id'=15
Some configs:
Rails 5.0.1
postmark (1.14.0)
postmark-rails (0.18.0)
production.rb
...
config.action_mailer.delivery_method = :postmark
config.action_mailer.postmark_settings = { :api_token => ENV["POSTMARK_API_KEY"] }
config.action_mailer.default_url_options = { host: "www.mywebsite.com" }
...
development.rb
...
config.action_mailer.delivery_method = :postmark
config.action_mailer.postmark_settings = { :api_token => ENV["POSTMARK_API_KEY"] }
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
...
staging.rb
...
config.action_mailer.delivery_method = :postmark
config.action_mailer.postmark_settings = { :api_token => ENV["POSTMARK_API_KEY"] }
config.action_mailer.default_url_options = { host: "website.herokuapp.com" }
...
sidekiq.yml
:concurrency: 3
:timeout: 60
:verbose: true
:queues:
- default
- mailers
Obs: all the three environments uses different postmark api key.
UPDATE 1
Here is the development:
development.rb
Rails.application.configure do
config.action_mailer.delivery_method = :postmark
config.action_mailer.postmark_settings = { :api_token => ENV["POSTMARK_API_KEY"] }
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
config.cache_classes = false
config.eager_load = false
# Show full error reports.
config.consider_all_requests_local = true
# Enable/disable caching. By default caching is disabled.
if Rails.root.join('tmp/caching-dev.txt').exist?
config.action_controller.perform_caching = true
config.cache_store = :memory_store
config.public_file_server.headers = {
'Cache-Control' => 'public, max-age=172800'
}
else
config.action_controller.perform_caching = false
config.cache_store = :null_store
end
config.assets.precompile += %w( '.svg' )
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_caching = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Suppress logger output for asset requests.
config.assets.quiet = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
end
I changed to the old configuration with gmail and the problem persists...
development.rb
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.action_mailer.delivery_method = :letter_opener
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports.
config.consider_all_requests_local = true
# Enable/disable caching. By default caching is disabled.
if Rails.root.join('tmp/caching-dev.txt').exist?
config.action_controller.perform_caching = true
config.cache_store = :memory_store
config.public_file_server.headers = {
'Cache-Control' => 'public, max-age=172800'
}
else
config.action_controller.perform_caching = false
config.cache_store = :null_store
end
config.assets.precompile += %w( '.svg' )
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_caching = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Suppress logger output for asset requests.
config.assets.quiet = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
domain: 'gmail.com',
user_name: ENV['GMAIL_ADDRESS'],
password: ENV['GMAIL_APP_PASSWORD'],
authentication: "plain",
enable_starttls_auto: true
}
config.action_mailer.default_url_options = {host: "localhost:3000"}
end
UPDATE 2:
I also tried to go to past branches which the mailing was working and nothing (I restarted the server)...
This is a partial solution to make possible to use mailing on test envs in my case.
On this rails mailing documentation on topic 10.2 Deserialization says:
If a passed record is deleted after the job is enqueued but before the #perform method is called Active Job will raise an ActiveJob::DeserializationError exception.
So I realized that somehow the record has being deleted from cache before the sending method (deliver_later) takes action. If this is going only on development and staging environments, then I attached on:
production.rb
config.active_job.queue_adapter = :sidekiq
development.rb / staging.rb
config.active_job.queue_adapter = :inline

Failing Mailer Test - ActionView::Template::Error: Missing host to link to

I currently have a failing test for one of my mailers and can't figure out what's causing it. I've tried some other solutions on stack like, adding Rails.application.routes.default_url_options[:host] = '???' to the config environment files but to no avail. Here is the error output form the terminal
Error:
OrderMailerTest#test_shipped:
ActionView::Template::Error: undefined method `protect_against_forgery?' for #<#<Class:0x007f97fe5f0080>:0x007f97ff82b790>
app/views/line_items/_line_item.html.erb:9:in `_app_views_line_items__line_item_html_erb__1698223746397690403_70145401700580'
app/views/order_mailer/shipped.html.erb:7:in `_app_views_order_mailer_shipped_html_erb__790900287724335052_70145401782860'
app/mailers/order_mailer.rb:23:in `shipped'
test/mailers/order_mailer_test.rb:14:in `block in <class:OrderMailerTest>'
bin/rails test test/mailers/order_mailer_test.rb:12
order_mailer_test.rb
require 'test_helper'
class OrderMailerTest < ActionMailer::TestCase
test "received" do
mail = OrderMailer.received(orders(:one))
assert_equal "Pragmatic Store Order Confirmation", mail.subject
assert_equal ["dave#example.org"], mail.to
assert_equal ["depot#example.com"], mail.from
assert_match /1 x Programming Ruby 1.9/, mail.body.encoded
end
test "shipped" do
mail = OrderMailer.shipped(orders(:one))
assert_equal "Pragmatic Store Order Shipped", mail.subject
assert_equal ["dave#example.org"], mail.to
assert_equal ["depot#example.com"], mail.from
assert_match /<td>1×<\/td>\s*<td>Programming Ruby 1.9<\/td>/, mail.body.encoded
end
end
and my config files.
development.rb
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
# Show full error reports.
config.consider_all_requests_local = true
# Enable/disable caching. By default caching is disabled.
if Rails.root.join('tmp/caching-dev.txt').exist?
config.action_controller.perform_caching = true
config.cache_store = :memory_store
config.public_file_server.headers = {
'Cache-Control' => 'public, max-age=172800'
}
else
config.action_controller.perform_caching = false
config.cache_store = :null_store
end
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
config.action_mailer.perform_caching = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Suppress logger output for asset requests.
config.assets.quiet = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
# Don't actually send emails
config.action_mailer.delivery_method = :test
# Alternate configuration example using gmail
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
domain: "domain.of.sender.net",
authentication: "plain",
user_name: "dave",
password: "secret",
enable_starttls_auto: true
}
end
production.rb
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
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
# 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
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com'
# 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
# Mount Action Cable outside main process or domain
# config.action_cable.mount_path = nil
# config.action_cable.url = 'wss://example.com/cable'
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
# 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 = [ :request_id ]
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
# Use a real queuing backend for Active Job (and separate queues per environment)
# config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "depot_#{Rails.env}"
config.action_mailer.perform_caching = false
# 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
# Use a different logger for distributed setups.
# require 'syslog/logger'
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
end
test.rb
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
config.cache_classes = true
# Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that
# preloads Rails for running tests, you may have to set it to true.
config.eager_load = false
# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
'Cache-Control' => 'public, max-age=3600'
}
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false
config.action_mailer.perform_caching = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end
Any advice would be appreciated!!
Try adding this to a helper that only your mailers will use and see if this works:
def protect_against_forgery?
false
end

Assets compiling on fly (Rails with compass gem)

I am trying to change my styles of my scss assets on my ruby on rails project but they are applying just after rake assets:precompile and restarting rails server.
With JS files everything allright and they are changing on fly.
Possible problem is with compass gem.
That is my repo - https://github.com/tanotify/blog
And file development.rb
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
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# 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
# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
end
Found solution! In config/environments/development.rb added line:
config.serve_static_assets = false

Asset not loading on production mode

Hello stackoverflow community,
I am building a Rails application which uses devise for authentication and it works fine on development mode. And when I host the app on Heroku everything works fine but the Checkbox next the question to save the password is missing.
I am using the Metronic Admin Theme which is based on Twitter Bootstrap.
Here is the checkbox which doesn't show up on production mode.
.form-actions
.checkbox
= f.check_box :remember_me
= f.label :remember_me, 'Passwort merken'
This is my production.rb file
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
# Disable Rails's static asset server (Apache or nginx will already do this)
# --> nope, enabled it because we dont have no nginx!
config.serve_static_assets = true
# Compress JavaScripts and CSS
config.assets.compress = true
config.assets.js_compressor = :uglifier
config.assets.css_compressor = :sass
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = false
# change this if you want to expire all your assets
config.assets.version = '1.0'
# Generate digests for assets URLs
config.assets.digest = true
# 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 = ENV['HTTPS'].to_bool
# Set to :debug to see everything in the log.
config.log_level = :info
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Disable automatic flushing of the log to improve performance.
config.autoflush_log = false
# 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
#Set timezone
config.time_zone = 'Bern'
# google analytics
GA.tracker = ENV['GA_TRACKER']
# mailers
config.action_mailer.delivery_method = :smtp
config.action_mailer.raise_delivery_errors = false
config.action_mailer.perform_deliveries = true
config.action_mailer.smtp_settings = {
address: ENV['SMPT_HOST'],
port: ENV['SMPT_PORT'].to_i,
domain: ENV['SMPT_DOMAIN'],
user_name: ENV['SMPT_USER'],
password: ENV['SMPT_PASS'],
authentication: :plain,
enable_starttls_auto: true
}
# default host for mailer and controllers
default_url_options = {
host: ENV['HOST_FOR_LINKS'], protocol: config.force_ssl ? 'https://' : 'http://'
}
config.action_mailer.default_url_options = default_url_options
routes.default_url_options = default_url_options
end
and my development.rb file
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
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = true
# Raises error for missing translations
config.action_view.raise_on_missing_translations = true
# strong_parameters: raise exception
config.action_controller.action_on_unpermitted_parameters = :raise
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = ENV['HTTPS'].to_bool
# mailcatcher
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { address: "localhost", port: 1025 }
#Set timezone
config.time_zone = 'Bern'
# default host for mailer and controllers
default_url_options = {
host: ENV['HOST_FOR_LINKS'], protocol: config.force_ssl ? 'https://' : 'http://'
}
config.action_mailer.default_url_options = default_url_options
routes.default_url_options = default_url_options
# Live reload for debugging
if ENV['LIVE_RELOAD'].to_bool
config.middleware.use Rack::LiveReload
end
end

Devise password reset works in production but not in development

Same goes with confirmable but that's another question. (Devise confirmable: Token is invalid error) This is my local server output
Started PUT "/users/password" for 127.0.0.1 at 2014-08-05 00:25:21 -0400
Processing by Devise::PasswordsController#update as HTML
Parameters: {"utf8"=>"√", "authenticity_token"=>"aa0iVP0Yy5F+QUG2WdifKjlWWLFupFQ95v6TM4pdhRE=", "user"=>{"reset_password_token"=>"[FILTERED]", "password"=>"[FILTERED]", "passw
ord_confirmation"=>"[FILTERED]"}, "commit"=>"Reset Password"}
User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."reset_password_token" = '687acf9f5b67f4a683220dce5bc411eb605a28ba43c751771b8bb24d08780d34' ORDER BY "users".
"id" ASC LIMIT 1
Rendered devise/passwords/edit.html.erb within layouts/application (1.0ms)
Rendered layouts/_messages.html.erb (0.0ms)
Completed 200 OK in 58ms (Views: 43.0ms | ActiveRecord: 0.0ms)
Code is EXACTLY the same as on heroku app however in heroku I am able to reset the password and in local it just keeps rendering edit password. Here are the environment files: Note that email setting for user and pw are changed for reasons
Production:
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
config.assets.precompile += ['active_admin.css']
# 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
config.action_mailer.default_url_options = { :host => "http://tracker-demo2.herokuapp.com/" }
# 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 Rails's static asset server (Apache or nginx will already do this).
config.serve_static_assets = 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
# Generate digests for assets URLs.
config.assets.digest = true
# Version of your assets, change this if you want to expire all your assets.
config.assets.version = '1.0'
# 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
# Set to :debug to see everything in the log.
config.log_level = :info
# 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"
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
# config.assets.precompile += %w( search.js )
# 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
# Disable automatic flushing of the log to improve performance.
# config.autoflush_log = false
# 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.eager_load = true
config.assets.digest = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.raise_delivery_errors = true
config.action_mailer.smtp_settings = {
address: 'smtp.gmail.com',
port: 587,
domain: 'example.com',
user_name: 'some#gmail.com',
password: 'Not tellin ya!',
authentication: 'plain',
enable_starttls_auto: true }
end
And Development:
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
config.action_mailer.default_url_options = { :host => "localhost:3000" }
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
config.eager_load = false
config.action_mailer.delivery_method = :smtp
config.action_mailer.raise_delivery_errors = true
config.action_mailer.smtp_settings = {
address: 'smtp.gmail.com',
port: 587,
domain: 'example.com',
user_name: 'some#gmail.com',
password: 'Not tellin ya!',
authentication: 'plain',
enable_starttls_auto: true }
end

Resources