I have just installed devise on my Ruby on Rails project, it worked perfect on localhost, but when i did the same on Live Server then it started throwing me following error:
undefined method `devise_for' for #<ActionDispatch::Routing::Mapper:0x007facfbc96e18>
i have already restarted the Nginx server by using this command:
sudo /etc/init.d/nginx restart
but no effect.
Thanks.
Note:
Rails version is Rails 4.2.7.1
Ruby version is ruby 2.2.4p230
Aha! finally...
I just stop and start the puma and it's started working. I ran the following commands:
ps aux | grep puma
kill -s SIGUSR2 17562
bundle exec puma -e development -d -b unix:///home/democraticags/digitalammo/shared/sockets/puma.sock
Anyways thanks to all of you who devoted their precious time :)
Related
I just updated from MacOS 12.x to 13.0.1
Starting a Rails app with
➜ rails s
works fine
=> Booting Puma
=> Rails 5.2.8.1 application starting in development
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.12.6 (ruby 2.6.6-p146), codename: Llamas in Pajamas
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://localhost:3000
Use Ctrl-C to stop
But when I try with
➜ rails s -d
Output stops at
=> Booting Puma
=> Rails 5.2.8.1 application starting in development
=> Run `rails server -h` for more startup options
And no server is started
➜ ps -ef | grep puma
501 69877 51917 0 6:45 ttys000 0:00.00 grep puma
➜ ps -ef | grep rails
501 72493 51917 0 6:49 ttys000 0:00.00 grep rails
Well, I found a workaround. This is by no means perfect but if it helps anyone with the same problem:
nohup rails s </dev/null >/dev/null 2>&1 &
The & at the end will make it run in the background. All output/input goes to/from /dev/null and nohup makes sure it will run even after you quit the session.
The reason has nothing to do with the fact that you updated to MacOS Ventura.
Puma daemonization has been removed without replacement since version 5.0.0, and it has been extracted to the puma-daemon gem, which currently works only with Puma version ~> 5.
Therefore now you have two ways to make it work: with puma-daemon, or put it in no hanghup background mode.
METHOD 1: USING PUMA DAEMON GEM
bundle add puma-daemon
Add these line to your application’s Gemfile:
gem 'puma-daemon', require: false
gem 'puma', '~> 5'
Add these lines to config/puma.rb:
require 'puma/daemon'
daemonize
and ensure you have set up at least one worker (workers 1)
Now you should be able to run puma webserver as a daemon with rails server (please notice that you must remove any -d or --daemonize from the command line)
PUT IT IN NO HANGHUP BACKGROUND MODE
Just run rails server --no-log-to-stdout & to put the server in background and stop the output, and enclose it in a nohup >/dev/null command to get rid of the nohup.log file:
nohup rails server --no-log-to-stdout >/dev/null &
This method works with any Puma version and doesn't require the gem.
Don't mess around with the two ways.
I am trying to run my rails application using Puma over ssl in Windows ServerR2. I followed an answer of this question. I have installed puma with the SSL directory and I run puma using
>puma -b 'ssl://127.0.0.1:3000?cert=C:\Sites\server.crt&&key=C:Sites\server.key' -e development -S puma -C config\puma.rb
Also, I have created the cert and key, using this link. But I get the error
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/puma-2.15.3/lib/puma/binder.rb:131:in `check': SSL not available in this build (StandardError)
works great in rails 5.2.3 and puma 3.12
gem uninst puma
ridk exec pacman -S mingw-w64-x86_64-openssl
gem inst puma
I want to monitor my app with upstart. I'm exporting using
rvmsudo foreman export upstart /etc/init -a <my_app_name> -u ubuntu -l /var/<my_app_name>/log
It finishes successfully, but when i do
sudo start <my_app_name>
I get the following output and nothing happens
<my_app_name> start/running
my procfile
web: rvmsudo passenger start -p80 -e production
worker: rvmsudo bundle exec rake jobs:work RAILS_ENV=production
Its really frustrating because i can run the web and worker commands on different terminals individually. So I tried to just do a foreman start and this fails with the following error
*** ERROR ***
Please install daemon_controller first:
/usr/local/rvm/gems/ruby-2.0.0-p594/wrappers/gem install daemon_controller
The frustrating bit is that daemon controller is installed and i can see it when i do gem list
Maybe my whole approach to this is wrong can someone please point me in the right direction?
Here's the line in passenger that returns that error, so it looks as though it really can't find daemon_controller as it's rescuing a LoadError. Try updating your web process to run via bundle exec also:
web: rvmsudo bundle exec passenger start -p80 -e production
I am making a chatting application using Ruby on Rails with Faye gem.
The app works on localhost after I inserted "localhost:9292/faye.js" in the index.html and I run the following script on command line:
rackup faye.ru -s thin -E production
ruby faye.rb
However, the app doesn't work on Heroku even if I changed the source url to "http://myappname.herokuapp.com/faye.js" and makes these errors.
http://myappname.herokuapp.com/faye.js 404 (Not Found)
ReferenceError: Faye is not defined
I've tried these commands but no luck so far.
heroku bundle exec rackup faye.ru -s thin
heroku bundle exec ruby faye.rb
It would be great if you could figure this out.
I appreciate for your help in advance!
I changed the url to "http://myappname.herokuapp.com:9292/faye.js"
and run the following commands on the commandline
heroku run bundle exec rackup faye.ru
heroku run bundle exec ruby faye.rb
Now I am getting this error
http://myappname.herokuapp.com:9292/faye.js net::ERR_CONNECTION_REFUSED
I tested the app with "foreman start" on localhost and everything worked.
However, it still does not work on Heroku.
I'm running bundle exec thin -p 4000 -e sandbox start 2>&1 and I get:
>> Using rails adapter
It just hangs there and I don't think that my Rails adapter is running. Does thin have a log or something I can see to find out what's going on?
look at this site
http://code.macournoyer.com/thin/doc/classes/Thin/Logging.html
it has the info you need to log the adapter
Turns out I had to use foreman to start things up and running.