Sign in through GitHub

ReinierKorth's Profile

GitHub User: ReinierKorth

Comments by

Avatar

Ignore my post 2 posts up. Turned my config was working fine.. Didn't realize they weren't being updated with normal cap deploys so my server still had the old ones in etc/nginx/sites-enabled...

Avatar

I've been struggling for a while now getting multiple apps online on one server so I hope someone can help me...

I've followed this tutorial to the letter apart from a few version changes (Ubuntu Server 12.04, rbenv 1.9.3p194).

Everything works fine with one website but as soon as I add another website things start to go wrong. At first nginx doesn't start and gives an error that I need to encrease my server_names_hash_bucket_size: to 64 which it's kinda weird because my domainnames for both sites aren't that long.

After changing that nginx starts again and the first site works but the second one gives an error. What's also weird is that my first sites stays the default site accessible by the ip of the server and all the domains pointing to it even though I have listen 80 default deferred; commented out.

I use this nginx.conf for both site with only the server_name different ofcourse:

ruby
upstream unicorn-<%= application %> {
  server unix:/tmp/unicorn.<%= application %>.sock fail_timeout=0;
}

server {
  # listen 80 default deferred;
  server_name slimmetelefoon.info;
  root <%= current_path %>/public;

  location ^~ /assets/ {
    gzip_static on;
    expires max;
    add_header Cache-Control public;
  }

  try_files $uri/index.html $uri @unicorn;
  location @unicorn {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;
    proxy_pass http://unicorn-<%= application %>;
  }

  error_page 500 502 503 504 /500.html;
  client_max_body_size 4G;
  keepalive_timeout 10;
}
Avatar

Never mind I figured it out :)

Change:

$("#products").html("<%= escape_javascript(render("products")) %>");

To:

$("#products").hide();
$("#products").html("<%= escape_javascript(render("products")) %>").fadeIn(500);

Avatar

Never mind I figured it out. I just added this helper function:

ruby
def sortableDesc(column, title = nil)
  title ||= column.titleize
  css_class = column == sort_column ? "current #{sort_direction}" : nil
  direction = column == sort_column && sort_direction == "desc" ? "asc" : "desc"
  link_to title, {:sort => column, :direction => direction}, {:class => css_class}
end
Avatar

Is there a way to set the default direction of certain columns to desc?

For example Popularity that uses the amount of hits. Right now the least popular item is when you click it once...

Thanks in advance!

Avatar

Anyone know how to nicely fadeIn the results? Thnx!

Avatar

I have many price fields (monthly, average, total etc).

Can these getter/setter methods be rewritten for use with all my fields?

Avatar

Thnx your solution works for my Dutch website where I rename my resources to Dutch words like so:

resources :users, :path => "gebruikers" do
resources :comments
end