I’m trying to setup MailyHerald with devise gem in a rails 4 app.
I followed these steps:
https://github.com/Sology/maily_herald/wiki/Setup-with-'devise'-gem
Now, when I try to register a new user (a confirmation mail should be sent via MailyHerald) I get this error:
NoMethodError at /user
undefined method `[]' for false:FalseClass
maily_herald (0.9.3) lib/maily_herald.rb
# Gets the Maily logger.
def logger
unless MailyHerald::Logging.initialized?
opts = {
level: options[:verbose] ? Logger::DEBUG : Logger::INFO,
}
opts[:target] = options[:logfile] if options[:logfile]
MailyHerald::Logging.initialize(opts)
end
Any idea? Thanks
EDIT:
A small update, maybe related to the error I get:
when I do
maily_herald paperboy --start
as indicated in the page above, I get
undefined method `merge' for false:FalseClass
EDIT 2:
Ok, I did some test.
I created a new app with devise from scratch (rails 4.2.5.1 and ruby 2.2.4p230).
Now I get no error when a user registers, but no confirmation email is sent.
Running background processing
maily_herald paperboy --start
returns this
[Maily#cli] INFO: Started with options: {:mode=>:paperboy, :action=>:start, :daemon=>true}
You really should set a logfile if you're going to daemonize
/Users/fabbrro/.rvm/gems/ruby-2.2.4#testMailyHerald/gems/maily_herald-0.9.3/lib/maily_herald/cli.rb:200:in `daemonize'
/Users/fabbrro/.rvm/gems/ruby-2.2.4#testMailyHerald/gems/maily_herald-0.9.3/lib/maily_herald/cli.rb:45:in `paperboy'
/Users/fabbrro/.rvm/gems/ruby-2.2.4#testMailyHerald/gems/maily_herald-0.9.3/bin/maily_herald:10:in `<top (required)>'
/Users/fabbrro/.rvm/gems/ruby-2.2.4#testMailyHerald/bin/maily_herald:23:in `load'
/Users/fabbrro/.rvm/gems/ruby-2.2.4#testMailyHerald/bin/maily_herald:23:in `<main>'
/Users/fabbrro/.rvm/gems/ruby-2.2.4#testMailyHerald/bin/ruby_executable_hooks:15:in `eval'
/Users/fabbrro/.rvm/gems/ruby-2.2.4#testMailyHerald/bin/ruby_executable_hooks:15:in `<main>’
To further investigate, I'm also trying to setup the sample application. I created some entity (users) and tried to send them emails (via mailcatcher).
Until now, even if devise gem is not installed, It seems I have no luck:
no message at all when running background processing,
no errors,
but also no mail is sent. Did someone managed to successfully try the app ?
I just noticed this question. Have You looked at my comment on github?
https://github.com/Sology/maily_herald/issues/17#issuecomment-182412069
Also, I checked my Procfile and I'm running:
web: bundle exec rails s
worker: bundle exec sidekiq -v
paperboy: bundle exec maily_herald paperboy
Sidekiq is essential for MailyHerald. I think it's not specified on Wiki page. let me know if this solves Your problem. I'll try also setup fresh app with Your setup. Any public repo I can look into?
UPDATE
Just created fresh app:
https://github.com/RailsApps/rails-devise
https://github.com/Sology/maily_herald/wiki/Setup-with-'devise'-gem
gem install mailcatcher
mailcatcher
gem install foreman
create Procfile in your app directory, with this code:
web: bundle exec rails s
worker: bundle exec sidekiq -v
paperboy: bundle exec maily_herald paperboy
foreman start
Then open mailcatcher and app in browser and sign up new user. You should see newly added mailing into dispatcher and sidekiq logs running this.
Related
I'm new to Rails so please bear with me.
Currently there is an existing project (Rails 4.1.6, Ruby 2.1.3) running on digital ocean VM (Ubuntu 14.04) and its connecting to Postgresdb 9.6 without any issues. I have to migrate this to new VM.
I have setup a new vm with Ubuntu 16.04, installed Rails and Ruby with exact same versions. I tried creating a test rails app and its working fine. However, when I tried to deployed the project from old server to this new one its giving me errors.
Details:
There was an error while trying to load the gem 'uglifier'.
Gem Load Error is: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.
Backtrace for gem load error is:
/usr/local/lib/ruby/gems/2.1.0/gems/execjs-2.7.0/lib/execjs /runtimes.rb:58:in `autodetect'
/usr/local/lib/ruby/gems/2.1.0/gems/execjs-2.7.0/lib/execjs.rb:5:in `<module:ExecJS>'
/usr/local/lib/ruby/gems/2.1.0/gems/execjs-2.7.0/lib/execjs.rb:4:in `<top (required)>'
/usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.6/lib /active_support/dependencies.rb:247:in `require'
/usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:247:in `block in require'
/usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.6/lib/active_support/dependencies.rb:232:in `load_dependency'
After searching on internet, most of them suggested to uncomment this line in the Gemfile.
# gem 'therubyracer', platforms: :ruby
This was commented in the old server, however, I tried uncommenting it and it came back with different error.
Migrations are pending. To resolve this issue, run: bin/rake db:migrate RAILS_ENV=development
Website was connecting to the same database and old webportal was running fine but it gave me this error. So I setup a new test db and ran the following commands -
RAILS_ENV=production bundle exec rake db:create
RAILS_ENV=production bundle exec rake db:setup
RAILS_ENV=production bundle exec rake db:migrate
All those commands were executed successfully but for some reason I'm still receiving "Migrations are pending....." error.
Please advise.
The migration-error seems to think you should be on the development environment... but the migrations you ran are for production... so either your environment-setting is not correct, or you need to run the migrations for development instead
I'm following Ruby on Rails Tutorial (Rails 5) Learn Web Development with Rails
Michael Hartl, using rails 5.0.0.1, when I tried to run the following command in bash
rails generate scaffold User name:string email:string
I received this error
Version: 1.7.2
Usage: spring COMMAND [ARGS]
Commands for spring itself:
binstub Generate spring based binstubs. Use --all to generate a binstub for all known commands. Use --remove to revert.
help Print available commands.
server Explicitly start a Spring server in the foreground
status Show current status.
stop Stop all spring processes for this project.
Commands for your application:
rails Run a rails command. The following sub commands will use spring: console, runner, generate, destroy, test.
rake Runs the rake command
rails aborted!
Don't know how to build task 'rails' (see --tasks)
/home/Medo/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/commands/rake_proxy.rb:13:in `block in run_rake_task'
/home/Medo/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/commands/rake_proxy.rb:10:in `run_rake_task'
/home/Medo/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:51:in `run_command!'
/home/Medo/.rvm/gems/ruby-2.3.1/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
bin/rails:9:in `require'
bin/rails:9:in `<main>'
(See full trace by running task with --trace)
I don't know what causing this issue and can't see a solution for it after hour of searching.
Well this what worked for me
bundle install --binstubs
after it, rails worked without a problem
This is what help give us. I just run this 3 commands and it's work.
Looks like your app's ./bin/rails is a stub that was generated by
Bundler.
In Rails 5, your app's bin/ directory contains executables that are
versioned like any other source code, rather than stubs that are
generated on demand.
Here's how to upgrade:
bundle config --delete bin # Turn off Bundler's stub generator
rails app:update:bin # Use the new Rails 5 executables
git add bin # Add bin/ to source control
You may need to remove bin/ from your .gitignore as well.
I am not sure but maybe it can help
$ spring stop
$ rails generate scaffold User name:string email:string
Can you check if rails s is working.Also try
bin/rails generate scaffold User name:string email:string
I am using Ruby on Rails.
I am trying to get Sidekiq to work with Redis and receive the following error whenever I am starting sidekiq.
#config/sidekiq.yml
#Config file for Sidekiq
:concurreny: 5
:queues:
-[mailer,5]
-[default,5]
When I run the following command:
bundle exec sidekiq -C config/sidekiq.yml
I get the error as follows:
undefined method `each' for "-[mailer,5] -[default,5]":String
Not sure what the error message says and how to fix it to get Sidekiq to load the configuration and start successfully. Thanks in advance for your answers and help.
YML requires exact formatting. You are missing a space after the dashes.
https://github.com/mperham/sidekiq/blob/master/examples/config.yml#L16
I created simple online chat using ROR and ActionCable.
And then try to deploy app to heroku.
But I have a strange error after deploy and app wont run.
Heroku build log:
.........
Bundle completed (0.70s)
Cleaning up the bundler cache.
Could not detect rake tasks
ensure you can run `$ bundle exec rake -P` against your app with no environment variables present
and using the production group of your Gemfile.
rake aborted!
TypeError: nil is not a symbol
/tmp/build_5cc20a589923a15d8ef20f9d30e7babf/kokosko-chat-c869529/vendor/bundle/ruby/2.0.0/bundler/gems/actioncable-98855fea634a/lib/action_cable.rb:29:in `module_function'
/tmp/build_5cc20a589923a15d8ef20f9d30e7babf/kokosko-chat-c869529/vendor/bundle/ruby/2.0.0/bundler/gems/actioncable-98855fea634a/lib/action_cable.rb:29:in `<module:ActionCable>'
/tmp/build_5cc20a589923a15d8ef20f9d30e7babf/kokosko-chat-c869529/vendor/bundle/ruby/2.0.0/bundler/gems/actioncable-98855fea634a/lib/action_cable.rb:22:in `<top (required)>'
.........
action_cable.rb from github:
# Singleton instance of the server
module_function def server #line #29
#server ||= ActionCable::Server::Base.new
end
Gemfile
gem 'actioncable', github: 'rails/actioncable'
At local machine all work fine.
Any ideas?
Source, if it will help: https://github.com/kokosko/chat/
This sounds like you were running ruby 2.0 or lower. Rails 5.0 requires ruby 2.2.
The precise cause for this error message is that in previous versions of ruby
def foo
end
returns nil, whereas as of ruby 2.1, it will return :foo. The code you posted relies on this change.
I've just installed the 'sidekiq' gem and trying to run the following from the Terminal:
bundle exec sidekiq
When I run this though, I get the following error. This error does not occur when running the Rails server or loading the environment in the console.
undefined method `skip_authorization_check' for SessionsController:Class
It makes me think that the sidekiq script is trying to do something and it can't see that method. But I've not been able to make much progress with this.
Any clues?