วันอังคารที่ 3 เมษายน พ.ศ. 2555

rails 3: Rails logger outside controller and model

ทำอย่างไร ถ้าต้องการเขียน log นอก controller และ model ?


ใช้ Rails.logger.info "Some debugging info I want to see in my development log."

วันพุธที่ 28 มีนาคม พ.ศ. 2555

Rails3: How to config rails project no database ?

มีวิธีทำให้ Rails Project ไม่ต้องใช้ database อย่างไร

ใน config/application.rb ให้ comment #require 'rails/all'

ใน config/environments/development.rb ให้ comment #config.active_record.xxxxxxx...

และให้เพิ่ม code ข้างล่างนี้แทนที่
require "action_controller/railtie"
require
"action_mailer/railtie"
require
"active_resource/railtie"
require
"rails/test_unit/railtie"
require
"sprockets/railtie"
อ้างอิง : http://stackoverflow.com/questions/3954307/rails-3-how-do-i-avoid-database-altogether


วันอังคารที่ 27 มีนาคม พ.ศ. 2555

Mysql : gem install mysql2 on windows

How to gem install mysql with reference connector ibrary ?
  1. Download mysql-connector-c-noinstall-xxxxxxxxx , วางไว้ที่ c:\
  2. gem install mysql2 --platform=ruby -- --with-mysql-dir=C:/mysql-connector-c-noinstall-xxxxxxxx

อ้างอิง :

http://blog.mmediasys.com/2011/07/07/installing-mysql-on-windows-7-x64-and-using-ruby-with-it/