The way Ryan has written the code, it should be compatible with turbolinks; I think it's turbolinks that needs some work.
Basically I had to add a 'data-no-turbolink' attribute within one of my html tags. I tried to use a tight scope of div tags around the most troublesome coding, and worked out wider and wider (parent to parent) until it finally worked.
Unfortunately, I had to move so far out, I might has well put my data-no-turbolink in the 'body' tag. :(
I might just end up removing turbolinks. Good Luck, and I hope this helps someone else in this similar mess.
Solved! I received some help on this. I figured it had something to do with environment variables getting lost, and I was right. unicorn needs to have an rvm ruby wrapper around it, by executing:
rvm wrapper 1.9.3 ruby-1.9.3 unicorn
and it creates a new init script to run called:
ruby-1.9.3_unicorn
afterwards you'll need to modify the unicorn_init.sh $CMD to read something like:
/usr/local/rvm/bin/ruby-1.9.3_unicorn -D -c $APP_ROOT/config/unicorn.rb -E production
If I run $ /etc/init.d/unicorn start, it runs just fine.
If I run $ service unicorn start, I get this error:
/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in 'require': cannot load such file -- bundler/setup (LoadError)
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in 'require'
from /var/rails/mbiri/shs/bin/unicorn:14:in ''
I cannot figure out why /etc/init.d would work, but service would not. It's driving me crazy trying to find the answer. I also think this is the reason why unicorn won't start on boot, because I'v already ran update-rc.d
Include inside your Gemfile
gem "thin"
gem "faye"
PS> It's turbolinks. See my post to Lisa up above. ^^^
Hey Lisa,
I figured it out: Turbolinks.
Take a look at Episode 390 (http://railscasts.com/episodes/390-turbolinks).
The way Ryan has written the code, it should be compatible with turbolinks; I think it's turbolinks that needs some work.
Basically I had to add a 'data-no-turbolink' attribute within one of my html tags. I tried to use a tight scope of div tags around the most troublesome coding, and worked out wider and wider (parent to parent) until it finally worked.
Unfortunately, I had to move so far out, I might has well put my data-no-turbolink in the 'body' tag. :(
I might just end up removing turbolinks. Good Luck, and I hope this helps someone else in this similar mess.
I'm having the same exact problem. The code is solid, becuase if I do a refresh on that page, then my remove & add starts to work.
It's as if the javascript hasn't quite loaded yet.
Any ideas for the slow load of Javascript? Using ruby 2, rails 4.
Solved! I received some help on this. I figured it had something to do with environment variables getting lost, and I was right. unicorn needs to have an rvm ruby wrapper around it, by executing:
rvm wrapper 1.9.3 ruby-1.9.3 unicorn
and it creates a new init script to run called:
ruby-1.9.3_unicorn
afterwards you'll need to modify the unicorn_init.sh $CMD to read something like:
/usr/local/rvm/bin/ruby-1.9.3_unicorn -D -c $APP_ROOT/config/unicorn.rb -E production
See http://stackoverflow.com/questions/10454292/ubuntu-12-04-unicorn-init-sh-start-works-but-service-unicorn-init-start-do for more info.
Problem in Ubuntu Server
If I run $ /etc/init.d/unicorn start, it runs just fine.
If I run $ service unicorn start, I get this error:
/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in 'require': cannot load such file -- bundler/setup (LoadError)
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in 'require'
from /var/rails/mbiri/shs/bin/unicorn:14:in ''
I cannot figure out why /etc/init.d would work, but service would not. It's driving me crazy trying to find the answer. I also think this is the reason why unicorn won't start on boot, because I'v already ran update-rc.d
I cannot seem to get that to work under Ubuntu. Any ideas?
Your correct, vagrant is not necessary. You can set everything up as usual. But where you might ask?
On server, I create the projects directory under /var/rails and somtimes suffixed with ./client-foo/project-bar
This is in tradition where apache sites are stored under /var/www.
So in other words, instead of:
/vagrant
use:
/var/rails
/var/rails/site
/var/rails/client-foo/project-bar
Dido on that request.
I discovered this link. It might be of help:
Thin vs unicorn vs passenger (http://www.ruby-forum.com/topic/1822610)
If I have a production site in a separate folder (www.somesite.com/appFolder/), then I'm not able to get the tokenInput to work correctly. Instead of:
tokenInput("/tags.json", ...
I need to say something like:
tokenInput("/appFolder/tags.json", ...
Is there a DRY way to do this so I do not have to manually edit the code on the production site every time? Thanks.
Yes, I was able to get this working in 3.1, coffescript style:
What is the HTML supposed to look like again?