Welcome To Snipplr


Everyone's Recent Snippets Tagged rails



The code to find all objects from a model and use them as select options.
1 1869 posted 16 years ago by smoothdzion
For separating a list of categories with a comma that are linked. There may be a better way. Leave a comment if you have a better way. This was the first way I found that worked. This code increments the count 1 at a time. It applies the incre...
1 1490 posted 16 years ago by smoothdzion
Used to create checkboxes to select multiple categories for a post or any other type of applicable situation.
1 1470 posted 16 years ago by smoothdzion
0 1295 posted 16 years ago by kerpunk
requires Rails libraries. could be rewritten to just use core Ruby libs, but I'm too lazy right now and I use this entirely in my Rails apps.
0 1930 posted 16 years ago by mepatterson
0 1784 posted 16 years ago by almazom
This could be further abstracted to work with other db's. Also, it really should be using Ruby's Tempfile class instead of assuming the local machine is *NIX based, but it works :)
0 1670 posted 16 years ago by nate63179
In this instance, used as an after-deploy hook to create a symlink to a shared db config file
0 1766 posted 16 years ago by nate63179
Можно выкладывать даже файлы, содержащие кириллицу в названии. Они будет подвергнуты транслитерации, пробелы и другие небезопасные симÐ...
0 1887 posted 16 years ago by almazom
creates something like list_49 with the 49 corresponding to id of record in database.
0 1524 posted 16 years ago by deschism
0 1489 posted 16 years ago by almazom
Put the following in your controller to define the content-type for *that* specific controller.
0 1372 posted 16 years ago by chrisamini
0 3800 posted 16 years ago by stephen
Code for a Rake task that allows compiles all LESS stylesheets (.less) contained within a single directory.
0 1715 posted 16 years ago by brettbergeron
1 1301 posted 16 years ago by webstic
0 1413 posted 16 years ago by hlubek
2 1990 posted 16 years ago by deschism
The 'request' and 'response' objects are chock full of useful info. But console can't usually access them. Here's how: start the server with the -u option, insert a breakpoint where you would like to have access to the controllers/helpers/etc. Wh...
1 2065 posted 17 years ago by cczona
jQuery client-side form validation for the Radiant CMS mailer extension. Requires jQuery 1.2.6+ Each required field needs a class of "required" assigned to the input tag.
0 1737 posted 17 years ago by bcalloway
Install an older version of a gem.
1 1642 posted 17 years ago by twofivethreetwo
Populate your states table with US States. Easy rake task for it.
2 1908 posted 17 years ago by twofivethreetwo