Welcome To Snipplr
Everyone's Recent Ruby Snippets
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
This allows you to search any INSTANCE or CLASS methods of any objects including rails models, which is helpful if you want to see the methods that you created yourself.
        
        
        
            1 
        
        
            1101 
        
                    posted 18 years ago by vanne
            Requires the twitter bundle.  This is an early attempt at updating this.  Pretty crude at the moment, but it works.
        
        
        
            2 
        
        
            1375 
        
                    posted 18 years ago by gtcaz
            Adapted from http://journal.mychores.co.uk/articles/2007/01/21/updating-twitter-from-ruby-rails
        
        
        
            2 
        
        
            1366 
        
                    posted 18 years ago by gtcaz
            Renders the partial template called 'cart', sends along local variable @cart, this will be known locally using the same name as the partial, 'cart'.
        
        
        
            1 
        
        
            1169 
        
                    posted 18 years ago by wackimonki
            The code tests if session[:counter] exists. If you leave out the all important '?', it will fail with an error.
        
        
        
            1 
        
        
            1360 
        
                    posted 18 years ago by wackimonki
            This will add up all the prices and return it?
What does |item| mean exactly?
        
        
        
            2 
        
        
            1371 
        
                    posted 18 years ago by wackimonki
            Redirects from one method to another in a controller. This is handy when there's an error, and you need to go back to index page, or for other purposes.
        
        
        
            1 
        
        
            1255 
        
                    posted 18 years ago by wackimonki
            Adds a button in view, which triggers a method.
"Empty cart" is the button name
empty_cart is the method name
        
        
        
            1 
        
        
            1295 
        
                    posted 18 years ago by wackimonki
            Catches an exception error, uses a technique called flash to display error on another page.
The Ruby on Rails code needs to be in a controller.
The rhtml code needs to be in the index layout.
        
        
        
            1 
        
        
            1194 
        
                    posted 18 years ago by wackimonki
            Add this inside your .irbrc file to call "show Model" in your console instead of "y Model.column_names"
        
        
        
            1 
        
        
            1183 
        
                    posted 18 years ago by vanne
            Add this to your ~/.irbrc file and you will have inline logging in the console
        
        
        
            1 
        
        
            1129 
        
                    posted 18 years ago by vanne
            Use this to sanitize a string and convert all wierd characters to your choice of delimiter
        
        
        
            1 
        
        
            1218 
        
                    posted 18 years ago by vanne
            Define multiple associations on the same associated class.  From the Rails Way blog.
        
        
        
            1 
        
        
            991 
        
                    posted 18 years ago by gnatware
            This replaces the PHP-based function in the HTML bundle.  You need to add two files to your bundle's Support/lib folder (create the directories if they're not present):
http://dev.rubyonrails.org/browser/trunk/actionpack/lib/action_controller/vend...
        
        
        
            6 
        
        
            2858 
        
                    posted 18 years ago by gtcaz
            Alternative bundle command for e (http://www.e-texteditor.com) or TextMate.
Replace YOUR_API_KEY_HERE with a valid API key -- you can find it on your Settings page (http://snipplr.com/settings/).
Changed the command to allow selection of langua...
        
        
        
            10 
        
        
            2411 
        
                    posted 18 years ago by gtcaz
            
