Send method assistance

I created a scaffolded project, and there is a line that I don’t
understand fully, even with the RDoc info

in my listing.rhtml:

<% for listing in @listings %>

<%=h listing.send( %>

What is the meaning of send( ?

The RDoc says that it should “invoke the method name identified by
symbol …”

But in this case, isn’t a method name (that I’m aware of),
so what is it calling or doing?




@listing I suppose is a collection of listing where you listing
a model in your database.

assuming listing database table listings have columns id,name

your model will have methods name=(val) and (#not exactly like this but
something like this)
“name” which will set and get the value ActiveRecord Base class will do
dynamically for you. will get value for you“xyz” will set value for you above will fetch “name” for you
then listing.send(>listing.send(“name”)=>
which will return the value for it.

hope this helps.


Ugh… My cut/paste in the original post left out a crucial line, and
after thinking about it, I think I know what it does …

<% for listing in @listings %>

<% for column in Listing.content_columns %> <%=h listing.send( %>

If I understand things right, for every listing, it is grabbing the
contents of each column, for each row, and placing the data into a table

hmmmm … sorry for the wasted bandwidth and thanks for the help.