Hello. I want create tag wich exec some method of controller and use its
variables like views in rails. With templates and
example:
controllers/store_controller.rb:
class StoreController < sitecontroller
def find_cart
session[:cart] ||= Cart.new
end
def add_to_cart
@cart = find_cart
@cart.add_product Product.find( params[:id] )
end
def initialize
@cart = find_cart
end
end
modules/cart_tags.rb:
tag ‘cart:show’ do |tag|
t = StoreController.new
@cart = t.cart
ret = “”
for cart_item in @cart
ret += cart.product+"
"
end
ret
end
You can not do that directly with standard Radiant, you need a Radiant
<-> Rails integration extension.
Search this list for radiant+rails+integration, there have been a few
post about this topic lately.
/AITOR
Aitor Garay-Romero wrote:
You can not do that directly with standard Radiant, you need a Radiant
<-> Rails integration extension.
Search this list for radiant+rails+integration, there have been a few
post about this topic lately.
/AITOR
I for a long time use extension ‘rails_support’. But I cannot use
patterns created by radiant cms.
For example it is necessary to add in tag the list from a method which
it is stored in the controller.
And I want to add. How use AJAX with radiant. I read some source of
other peole, but they do this very hard.