» Archive for the 'Ruby on Rails' Category

Install Ruby on Rails , Lighttpd,Sqlite3 and Mongrel under Ubuntu

Friday, October 20th, 2006 by rubypdf

nothing but the script I used:
#install Mysql
apt-get install mysql-server

#install Ruby and relative
apt-get install irb libdbm-ruby1.8 libgdbm-ruby1.8 libmysql-ruby1.8 libmysqlclient14 libopenssl-ruby1.8 libruby1.8-dbg mysql-common ri ri1.8 ruby1.8-dev

#install rubygems
wget http://rubyforge.org/frs/download.php/11289/rubygems-0.9.0.tgz
tar zxfv rubygems-0.9.0.tgz
cd rubygems-0.9.0
ruby setup.rb
gem update –system

#install Rails and dependencies
gem install rails –include-dependencies

#before install Mongrel,
apt-get install build-essential #we need it to compile mongrel and Sqlite3

#intall Mongrel
gem install mongrel –include-dependencies

#install Sqlite3
apt-get install sqlite3 swig libsqlite3-ruby libsqlite3-dev
gem install sqlite3-ruby #compile this need libsqlite.h

#install Lighttpd
apt-get install lighttpd

some useful link
http://mongrel.rubyforge.org/docs/lighttpd.html
http://fo64.com/articles/2005/10/20/rails-on-breezy
http://scottstuff.net/blog/articles/2006/07/23/typo-installer

UTF-8,Ruby on Rails under Ubuntu

Friday, October 20th, 2006 by rubypdf

I installed Ruby on Rails under Ubuntu(from /var/lib/locales/supported.d/local, I know, my default charset is en_US.UTF-8 UTF-8), and create a demo, by default, mysql (table type is MyISAM)supports UTF-8. But when I input Chinese character and save to database, the output on the web is UTF-8 code, not what I want, why? After searching, I got the answer , I need modify app/controller/application.rb just like this:

class ApplicationController < ActionController::Base
before_filter :set_charset

def set_charset
@headers["Content-Type"] = "text/html; charset=utf-8"
end
end

P.S.
My environment:
Server:
OS: Ubuntu 6.06.1 on Vmware(default charset is en_US.UTF-8 UTF-8)
Ruby: 1.8.4
Rails: 1.1.6
Mysql: 5.0.2
Mongrel: 0.3.13.4
Client:
Firefox: 1.5.0.6
IE: 6.0

GrabTheMic:A Ruby on Rails version Digg/Reddit

Tuesday, October 10th, 2006 by rubypdf

GrabTheMic is an Open Source implementation of community-driven news sites such as Digg (http://www.digg.com) and Reddit (http://www.reddit.com). It is powered by Ruby on Rails, and the main version of the code is run at http://www.grabthemic.org