RailsCasts Pro episodes are now free!

Learn more or hide this

Eric Wanchic's Profile

GitHub User: wanchic

Comments by Eric Wanchic

Avatar

Include inside your Gemfile
gem "thin"
gem "faye"

Avatar

PS> It's turbolinks. See my post to Lisa up above. ^^^

Avatar

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.

Avatar

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.

Avatar

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.

Avatar

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

Avatar

I cannot seem to get that to work under Ubuntu. Any ideas?

Avatar

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

Avatar

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)

Avatar

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:

ruby
tokenInput("/tags.json", ...

I need to say something like:

ruby
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.

Avatar

Yes, I was able to get this working in 3.1, coffescript style:

ruby
jQuery ->
  $("#patient_tag_tokens").tokenInput("/tags.json", {
    crossDomain: false,
    prePopulate: $("#patient_tag_tokens").data("pre"),
    theme: "facebook",
    preventDuplicates: true
  });
Avatar

What is the HTML supposed to look like again?