Profile
Achievement
wackimonki's Recent Snippets
- All /
« Prev 1 Next »
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
759
posted 17 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
858
posted 17 years ago by wackimonki
This will add up all the prices and return it?
What does |item| mean exactly?
2
723
posted 17 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
805
posted 17 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
689
posted 17 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
717
posted 17 years ago by wackimonki