app/helpers/bodega/application_helper.rb in bodega-0.2.0 vs app/helpers/bodega/application_helper.rb in bodega-0.3.0

- old
+ new

@@ -1,11 +1,17 @@ module Bodega module ApplicationHelper - def button_to_cart(product, label = 'Add to Cart') - form_tag(bodega.add_path) do - hidden_field_tag('product[type]', product.class) + - hidden_field_tag('product[id]', product.id) + - button_tag(label) + def self.included(base) + base.class_eval do + alias :method_missing_without_bodega :method_missing + alias :method_missing :method_missing_with_bodega end + end + protected + def method_missing_with_bodega(method_name, *args) + if method_name.to_s =~ /.+_(url|path)$/ && main_app.respond_to?(method_name) + return main_app.send(method_name, *args) + end + method_missing_without_bodega method_name, *args end end end