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: </head>
7: <body>
8: <div style="width:300px;height:415px">
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
----
<html>
<head>
<%= stylesheet_link_tag(''live_tree'') %>
<%= javascript_include_tag "prototype" %>
<%= javascript_include_tag "live_tree" %>
</head>
<body>
<div style="width:300px;height:415px">
<%= live_tree(:customer, {
:initial_data_root => @root,
:on_click_item => "alert(''You
clicked'')",
}) %>
</div>
</body>
</html>
Any thoughts would be most appreciated.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---