# Method method does not find attributes

**URL:** <https://www.ruby-forum.com/t/method-method-does-not-find-attributes/108520>\
**Category:** Rails\
**Created:** [July 4, 2007, 11:52am UTC](https://www.ruby-forum.com/t/method-method-does-not-find-attributes/108520 "2007-07-04T11:52:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tmendo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/3bc359/32.png) [@tmendo](https://www.ruby-forum.com/u/tmendo)\
**Post date:** [July 4, 2007, 11:52am UTC](https://www.ruby-forum.com/t/method-method-does-not-find-attributes/108520/1 "2007-07-04T11:52:35Z")

</div>

Hi,

I have something like this in an partial template:

\<% @fields.each { |field| %\>  
\<% m = host.method(field) %\>

\<%= m.call %\>  
\<% } %\>

This does not work because host.methods does not have the attribute  
accessors methods!  
But if I do this:

\<% @fields.each { |field| %\>  
\<% host.name %\>  
\<% m = host.method(field) %\>

\<%= m.call %\>  
\<% } %\>

the host.methods returns all the attributes that did not return before.  
So before I can call a method with host.method(field) I must call it  
normally, for instance, host.name!

What am I doing wrong?
