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?
Related
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.
I'm trying to pipe mail from postfix to a rails tasks. I've got this working successfully when just piping to a vanilla ruby script, but when switching to a rails task I get the following error in the mail.log from Postfix:
(Command died with status 1: "/usr/local/bin/rake". Command output: /usr/lib/ruby/1.9.1/rubygems/dependency.rb:247:in to_specs': Could not find rake (>= 0) amongst [] (Gem::LoadError) from /usr/lib/ruby/1.9.1/rubygems/dependency.rb:256:into_spec' from /usr/lib/ruby/1.9.1/rubygems.rb:1231:in gem' from /usr/local/bin/rake:22:in' )
Here is the piping line from master.cf
email-task unix - n n - 2 pipe
flags=Xhq user=appuser directory=/home/myapp/application/ argv=/usr/local/bin/rake RAILS_ENV=production myapp:process_email
Running the command which rake returns /usr/local/bin/rake so I have verified I have the correct rake path.
I've tried setting ENV['PATH'] inside of the .rake file to /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games and I've also tried cd'ing to the rails app directory in the pipe command but still causes the same error. I've done bundle install and update etc.
Any help is greatly appreciated...thank you!
UPDATE
I tried using bundle exec rake etc as suggested but am now getting this error:
Command died with status 127: "/usr/local/bin/bundle". Command output: bundler: command not found: rake Install missing gem executables with bundle install
I've tried adding gem 'rake' to the Gemfile as well. I'm assuming bundler can't find the Gemfile?
UPDATE (FIXED)
So the command that finally worked was the following:
email-task unix - n n - 2 pipe
flags=Xhq user=appuser directory=/home/myapp/application/ argv=/usr/local/bin/bundle exec /usr/local/bin/rake RAILS_ENV=production mytask
It was a combination of errors on my part.
Full paths need to be used for bundle and rake
app name is not needed in the task param for rake since the directory is being selected before executing
A side issue: an old version of ruby was being used which caused an unrelated gem error after executing the postfix pipe
Appreciate the help everyone.
I think your on the wrong track, it's not the system that can't find rake it's your rubygems. Instead of running rake as your command, try running bundle passing whatever you need to in order for it to basically be bundle exec rake...etc
Update
Based on your new information, it would seem that the rake gem is not installed in your app. Run bundle show rake
Assuming it's not there, I'm wondering why. Did you ship your app with packaged gems or something? Basically, did you not run bundle install in your deployed app?
In my rails app I am using the gem 'acts_as_follower' I have run the generate command, rake db:migrate set-up the user model but when I go onto my localhost it just says undefined local variable or method 'acts_as_followable'
does anyone have any ideas how I could fix this?
Do bundle install and restart your server.
I am trying to install queue-tip on my asterisk server using the following guide:
http://queue-tip.rubyforge.org/install.html
However I am unable to proceed past the following step as it throws this error:
rake gems:install
rake aborted!
undefined method `name' for "abstract":String
Tasks: TOP => environment
Any help please?
To install a gem, use the gem command, e.g. gem install rails. If you're in a Rails 3.x environment, add to the file Gemfile.rb in a format similar to others already included, then run bundle install from your project directory.
I've added gem 'delayed_job' to my gem file and ran a bundle install.
After that I ran rails generate delayed_job
I've created a controller named Online with a method online.
In turn after the method declaration I added the following line:
handle_asynchronously :online
I start up my app, but the code in that method does not run.
What am I doing wrong?
I'd guess that you haven't done rake jobs:work anywhere. From the fine manual:
Running the jobs
You can invoke rake jobs:work which will start working off jobs. You can cancel the rake task with CTRL-C.
You might want to set up Foreman to start the Rails server and the Rake task at the same time in your development environment; there's even a Railscast about it:
http://railscasts.com/episodes/281-foreman