Skip to content

Instantly share code, notes, and snippets.

View denysonique's full-sized avatar

Dennis Prochniak denysonique

View GitHub Profile
@denysonique
denysonique / my_model.rb
Created July 1, 2011 17:14 — forked from mnaser/my_model.rb
Is there a cleaner/simpler way of doing this?
class MyModel < ActiveRecord::Base
after_initialize :setup_defaults
attr_accessor :foo_bar
def setup_defaults
@foo_bar ||= "my default value"
end
end
$('document').ready(function() {
// Don't work
$( "#message_number_false" ).click(
function() {
$( "#call_back_text" ).show(100);
});
// Don't work
$( "#message_number_true" ).click(
function() {
def add_line_item_to_cart
#Get current_cart object
current_cart
quantity = params[:quantity].to_i
id = params[:id].to_i
line_item = LineItem.find(:first, :conditions => {:cartridge_id => id, :cart_id => current_cart.id})
if line_item
line_item.cart_id = current_cart.id