Thursday, September 11, 2008

Install Restful Authentication

Steps:
  1. Under project folder, run "script/plugin source http://svn.techno-weenie.net/projects/plugins/"
  2. Under project folder, run "script/plugin install restful_authentication"
  3. Under project folder, run "script/generate authenticated user sessions"
  4. Inside route.rb, add "map.activate '/activate/:activation_code', :controller => 'users', :action => 'activate', :activation_code => nil"
  5. Inside route.rb, add "map.signup '/signup', :controller => 'users', :action => 'new'"
  6. Inside route.rb, add "map.login '/login', :controller => 'sessions', :action => 'new'"
  7. Inside route.rb, add "map.logout '/logout', :controller => 'sessions', :action => 'destroy'"
  8. Under project folder, run "rake db:migrate"
  9. Inside, app controller, add "include AuthenticatedSystem" to application controller
  10. Inside, app controller, add "before_filter :login_required" to controller requiring authentication

Thursday, August 21, 2008

Install sqlite3 on Windows for Ruby on Rails

  1. Go to http://www.sqlite.org, and download sqlitedll under "Precompiled Binaries For Windows".
  2. Extract the file and put two files sqlite3.dll and sqlite3.def in the ruby bin's directory, i.e., C:\ruby\bin.
  3. Run "gem install sqlite3-ruby" to install sqlite3-ruby gem. (Try "gem install --version 1.2.3 sqlite3-ruby" if the latest version is not working)
  4. For GUI interface, download "SQLite Manager" plugin for Firefox.
  5. Under your project, config/database.yml, make sure you use sqlite3 adapter. Something like: development:
    adapter: sqlite3
    database: db/development.sqlite3
    timeout: 5000