Welcome To Snipplr
Everyone's Recent Ruby Snippets
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
Add a method to ActiveRecord::Migration to automatically drop created tables/indexes within the current migration file.
        
        
        
            1 
        
        
            942 
        
                    posted 19 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 
        
        
            1087 
        
                    posted 19 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 
        
        
            2478 
        
                    posted 19 years ago by tjstankus
            This method generates random (and printable) ascii characters.
        
        
        
            1 
        
        
            1545 
        
                    posted 19 years ago by ishikawa
            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 
        
        
            2408 
        
                    posted 19 years ago by tjstankus
            reference:
\n
http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/classes/Net/HTTP.html
http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/index.html
        
        
        
            7 
        
        
            2697 
        
                    posted 2025 years ago by aravet
            
