Displaying 2 results from an estimated 2 matches for "mycontrollerhelper".
2006 Apr 24
7
Controller can''t find helper?????!!!!!????
I have a controller named xyzController under app/controllers
I have a helper class named xyzHelper under app/helpers.
Shouldn''t I be able to call methods from xyzHelper inside of
xyzController without any problems?
Thanks,
Wes
--
Posted via http://www.ruby-forum.com/.
2006 Mar 02
0
Cleaner code in rails view
...nil.
So I tried the trick posted earlier and it cleaned it up nicely. I''m
sure that this problem comes up all the time, and there are probably
better ways to handle it, but this abstraction was quite nice:
In the controller''s helper, I added a method_missing dispatcher:
module MycontrollerHelper
def method_missing(methodname, *args)
"MISSING RECORD"
end
end
In the view: (in my case rxml)
xml << (table1.table2 || self).field
I think for rhtml it would be :
<%= (table1.table2 || self).field %>
Hopefully, you have no other need for method_missing in your view...