Halaman

Rabu, 17 November 2010

[shared] Rails migration integer limit

:limit Numeric Type Column Size Signed Max value Unsigned Max value
1 TINYINT(4) 1 byte 127 255
2 SMALLINT(6) 2 bytes 32767 65535
3 MEDIUMINT(9) 3 bytes 8388607 16777215
4 and others INT(11) 4 bytes 2147483647 4294967295
5..8 BIGINT(20) 8 bytes 9223372036854775807 18446744073709551615

Minggu, 14 November 2010

[shared] rails user role system

https://github.com/timcharper/role_requirement

installation:
- ruby script/generate roles Role User

installation will do:

  • Generates habtm table, creates role.rb with the habtm declaration. Adds declaration in user.rb (scans the code for "class User < ActiveRecord::Base", and puts the new code right after it.



  • Creates an admin user in users.yml, with a role named admin in roles.yml, including a fixture to demonstrate how to relate roles to users in roles_users.yml



  • Modify the user.rb (or corresponding user model) file, add the instance method has_role?



  • Generates RoleRequirementSystem against for the corresponding user model.



  • Generates a migration to make the necessary database changes



  • Scans ApplicationController, inserts the lines "include AuthenticatedSystem", and "include RoleRequirementSystem", if not already included.



  • Scans test_helper.rb and adds "includes RoleRequirementTestHelpers", if not already included.




Usage:
- add require_role "role_name" in controller, similar to before_filter

[shared] rails exception logger

https://github.com/defunkt/exception_logger

installation:
- ruby script/generate exception_migration
- rake db:migrate
- in application_controller.rb add
include ExceptionLoggable
rescue_from Exception, :with => :exception_handler

private

def exception_handler exception
log_exception exception
render "/500.html"
end


the default controller and view using prototype.js instead of jquery so i created my own controller view under admin namespace. the database pretty simple and similar to rails exception notification

for rails 3:
https://github.com/QuBiT/exception_logger

Rabu, 10 November 2010

kaspersky conflicting with tortoise svn

kaspersky, settings, exclusions, add:
- rules for the project folder
- trusted application for:
- - ..\system32\searchprotocolhost.exe
- - ..\system32\searchfilterhost.exe
- - ..\tortoisesvn\bin\tsvncache.exe
- - ..\tortoisesvn\bin\tortoiseproc.exe
- - ..\tortoisesvn\bin\tortoisemerge.exe

other possible cause:
win7 bug prior sp1: http://support.microsoft.com/kb/982927/en-us

Kamis, 04 November 2010

Mysql::Error: query: not connected

MySQL 5.1 client library doesn't play well with Rails

download:
http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/libmySQL.dll

source:
http://forums.aptana.com/viewtopic.php?f=20&t=7563&p=27407&hilit=libmysql.dll#p27407