Hey Folks,
I’m receiving the following error when I try to use “acts_as_tree” to
load database table data from Sybase:
NoMethodError in Customer#show_tree
Showing app/views/customer/show_tree.rhtml where line #9 raised:
undefined method `name’ for #Customer:0x4941778
Extracted source (around line #9):
6:
7:
8:
9: <%= live_tree(:customer, {
10: :initial_data_root => @root,
11: :on_click_item => “alert(‘You clicked’)”,
12: }) %>
CONTROLLER
Here’s some of my code:
class CustomerController < ApplicationController
live_tree :customer, :model => :customer
def show_tree
@root = Customer.find(params[:id]);
end
end
MODEL
class Customer < ActiveRecord::Base
acts_as_tree :order => “id”, :counter_cache => true
end
VIEW
<%= stylesheet_link_tag('live_tree') %> <%= javascript_include_tag "prototype" %> <%= javascript_include_tag "live_tree" %>
<%= live_tree(:customer, {
:initial_data_root => @root,
:on_click_item => "alert('You clicked')",
}) %>
Any thoughts would be most appreciated.