Yes I did, self is point to the controller and not model. I need something like self.model.root().

Leon Yeh
New Avenue Systems Inc.
Office: (626)254-1757 x880
[EMAIL PROTECTED]
Imagination Delivered. www.newavenue.net




Patrick Crowley wrote:
Have you tried this?

  def display_node
     self.root()
  end

-- Patrick


On Jun 27, 2007, at 11:32 AM, Leon Yeh wrote:

Hi,

I am trying to refactoring two helper files into one single file.
The helper module is to display act_as_tree model type of object. I am
currently have two helper files that have the same exact code, so I
decided to combined them into one single file. Then have the controller
to include the correct helper module.

My problem is at the tree helper module. I need to have access to the
model object, instead of just hardcoding the name of model object. I
tried to look around at the documentation, but got nowhere. Any idea on how to get to the corresponding model object ?

Thanks in advance,
Leon

------------------

class MarketplaceController < ApplicationController
  helper :tree
end


class ListingController < ApplicationController
  helper :tree
end


module TreeHelper

  def display_node
     Marketplace.root() #???
  end
end

Leon Yeh
New Avenue Systems Inc.
Imagination Delivered. www.newavenue.net
_______________________________________________
Sdruby mailing list
[email protected]
http://lists.sdruby.com/mailman/listinfo/sdruby
_______________________________________________
Sdruby mailing list
[email protected]
http://lists.sdruby.com/mailman/listinfo/sdruby

Reply via email to