Method method does not find attributes

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?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs