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
775
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
885
posted 17 years ago by wackimonki
This will add up all the prices and return it?
What does |item| mean exactly?
2
741
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
820
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
705
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
734
posted 17 years ago by wackimonki