Sent from my iPhone
On May 19, 2010, at 8:04 PM, Me <[email protected]> wrote:
If you have an array of objects and you do
array_of_objects.each do |o|
o.method
end
Do the attributes of the object get passed to the method so you can
access them?
The object's attributes are available within the instance method. For
example,
class MyClass
attr_accessor :foo, :bar
def some_method
# access the attributes
@foo = 1
self.bar = "test"
end
end
o.some_method
I would recommend getting a copy of Programming Ruby.
Good luck,
-Conrad
--
You received this message because you are subscribed to the Google
Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-
[email protected].
To unsubscribe from this group, send email to [email protected]
.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
.
--
You received this message because you are subscribed to the Google Groups "Ruby on
Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.