Welcome To Snipplr


Everyone's Recent Snippets Tagged rails



1 2 3 4 5 6 7 Next »
Useful for when you need to do a find and map specific results to an array for use later
1 999 posted 18 years ago by vanne
This is useful for using ActiveRecord validations without the ActiveRecord DB dependencies, this snippet is meant to be used with Textmate... create this in models/name_of_your_model to use.
4 1505 posted 18 years ago by vanne
This allows you to turn off ajax requests application wide, so that you don't have to do render :layout => false in every controller that needs it.
1 1272 posted 18 years ago by vanne
fixture_file_upload is another nifty Rails testing feature. It allows you to create "MIME-encoded content that would normally be uploaded by a browser input field." (Part in quotes straight from Agile Web Development with Rails, v2). Put your files t...
3 1997 posted 18 years ago by tjstankus
Rails builds on the standard Ruby observer, so you can too. Originally found at http://rails.techno-weenie.net/forums/1/topics/672?page=6, so don't give me any credit ;)
2 918 posted 18 years ago by stuckinrealtime
0 975 posted 18 years ago by whitetiger
1 1164 posted 18 years ago by whitetiger
2 1302 posted 18 years ago by whitetiger
1 1056 posted 18 years ago by whitetiger
This snippet is Polish-language specific. This class expands a number (Fixnum or Bignum) into a string with a textual representation of that number in Polish language. Currency suffix supported. Example: 456 -> "four hundred fifty six" (but in Polis...
0 741 posted 18 years ago by komor
1 909 posted 18 years ago by andyh
by xurde
2 1191 posted 18 years ago by xurde
1 966 posted 18 years ago by andyh
1 899 posted 18 years ago by andyh
0 1070 posted 18 years ago by jnunemaker
2 1255 posted 18 years ago by jnunemaker
1 896 posted 18 years ago by bbuckley
Add foreign key support for migration
1 887 posted 18 years ago by ctran
Add a method to ActiveRecord::Migration to automatically drop created tables/indexes within the current migration file.
1 786 posted 18 years ago by ctran
To assert the difference in values before and after some code blocks. Save this as assert_helper.rb and include it in your test_helper.rb
1 900 posted 18 years ago by ctran
The key here is display:none being in the style attribute of the affected div. It will not work if it's in a separate CSS file.
6 1283 posted 18 years ago by tjstankus
2 1032 posted 18 years ago by darthapo
A fairly DRY way to test for required attributes of a model. It's sort of an alternative to fixtures. It breaks the one-assertion-per-test rule that some people favor. Drop in your unit test and edit as necessary. A better (yet not quite perfect)...
3 1229 posted 19 years ago by tjstankus
2 1049 posted 19 years ago by tjstankus
1 2 3 4 5 6 7 Next »