Welcome To Snipplr


Everyone's Recent Rails Snippets Tagged rails



« Prev 1 2 3
Useful for building nested entries checkboxes etc
0 2936 posted 10 years ago by davidb
A very concise ruby on rails helper method that converts seconds into human readable format. It will not display any time periods that have 0 (ie: 1 hour 13 seconds - skipping minutes as there were none) Due to complexity, months were not factored...
0 2354 posted 11 years ago by uberdragon
You want to start a new Rails app. But you also want to start a new RVM gemset for the app so you can start with the latest Rails and gems. In this code snippet I show how I start off an up-to-date Rails project in a clean gemset.
1 3156 posted 12 years ago by dreamstarter
Supported brands name | key ----------------------- American Express | :amex China UnionPay | :unionpay Diners Club | :diners Dinner Club US | :diners_us Discover | :discover...
0 4192 posted 12 years ago by Fivell
Working on the problem described here: http://forums.att.com/t5/Data-Messaging-Features-Internet/3G-proxy-wnsnet-attws-com-strips-HTTP-response-headers/m-p/3294533/highlight/false#M59737 After some testing we found the below code to fix our troubl...
0 3136 posted 12 years ago by mightybs
Esto suele ocurrer muy amenudo cuando instalamos Ruby on Rails antes que MySQL. Es un error "Library not loaded: libmysqlclient.18.dylib (LoadError)" donde lista los directorios donde busca y no lo encuentra. La solución es guiarle para que lo encue...
0 3002 posted 13 years ago by skozz
0 2849 posted 13 years ago by guhelouis
0 2928 posted 13 years ago by abstraktor
0 3009 posted 14 years ago by avioli
If each title is unique and you need alphabetical, try this in your Post model. You can change title to any unique attribute (created_at, id, etc.) if you need a different sort order.
0 2893 posted 14 years ago by gmericksen
0 1398 posted 14 years ago by batamire
This will require a user to log back in if they are inactive for more than 10 minutes. In order for this feature to be used you must have a last_request_at datetime column in your table for whatever model you are authenticating with.
0 1352 posted 14 years ago by gmericksen
0 2927 posted 15 years ago by alx_g
tag links with .click function
0 2861 posted 15 years ago by insanedreamer
Add this to .irbrc. Allows the following in console: > gethtml('/login') => HTML of whatever page is generated by /login
0 3018 posted 15 years ago by insanedreamer
in Rails 2, use `include ActionController::UrlWriter` instead.
1 2858 posted 15 years ago by insanedreamer
Put this in `test_helper.rb` and call with `show(object1, object2, etc.)`
0 2903 posted 15 years ago by insanedreamer
0 2652 posted 15 years ago by gmericksen
0 1128 posted 15 years ago by deschism
0 1041 posted 15 years ago by inkdeep
0 812 posted 15 years ago by nflamel
0 989 posted 15 years ago by nflamel
0 1044 posted 15 years ago by almazom
This lets you type Mandarin tones like a1, o2, e3, and so on instead of having to type the real pinyin. The tones are saved with the proper characters in the database.
0 1264 posted 15 years ago by 67ideas
This is the code I use when I want to test a helper. It uses Factory Girl and Shoulda, but they're not needed to make it work.
0 1293 posted 15 years ago by nflamel
« Prev 1 2 3