Rails (or Ruby): Yes/No instead of True/False

I know I could easily write a function and put it in the application controller, but I'd rather not if there is something else that does this already. Basically I want to have something like:

>> boolean_variable?
=> true
>> boolean_variable?.yesno
=> yes
>> boolean_variable?.yesno.capitalize
=> Yes

is there something like this already in the Rails framework?

37
задан aarona 8 September 2010 в 02:12
поделиться