Hi
I am pretty new to Ruby on Rails. I am writing an application
(rkalzium.rubyforge.org) and am running into a problem which I just
don''t
get.
I will give you the URL to webcvs so that you can look into the Code:
http://rubyforge.org/cgi-bin/viewcvs.cgi/rkalzium/app/controllers/chemistry.rb?rev=1.2&cvsroot=rkalzium&content-type=text/vnd.viewcvs-markup
As you can see in the file chemistry.rb the class ElementeList has the methods
def with_name(name)
@elements.find {|element| name == element.name }
end
def foo_bar(hallo)
end
http://rubyforge.org/cgi-bin/viewcvs.cgi/rkalzium/app/views/todo/lists.rhtml?rev=1.2&cvsroot=rkalzium&content-type=text/vnd.viewcvs-markup
In this view (lists.rhtml) you see that I am trying access the method
foo_bar("hallo"). This results in this errormessage:
Showing /todo/lists.rhtml where line #7 raised undefined method
`foo_bar'' for
#<ElementeList:0xb75ff838>
The funny thing is that this code work:
<%= @list.with_name("Carbon").name %>
@list is a ElementeList (it contains 111 objects of the class
"Element"). I
can also do this:
<%= @list[4].name %>
Any help is very welcome, I simple don''t have a clue. I am using ruby
1.8.2
and the latest stable rails and WebBrick if that matters. You can download
the code using the cvs-interface.
Grettings,
Carsten
--
10.0 times 0.1 is hardly ever 1.0.
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails