On 24 February 2011 17:07, Peter D Bethke <[email protected]> wrote:
> def get_company_branches
> my_branches = self.company.branches
> my_list = my_branches.each { |x| puts x.branch_name }
> return my_list
> end
You might find that something like this is what you're after:
def get_company_branches
self.company.branches.collect(&:branch_name).join(", ") if
self.company && self.company.branches
end
Have a look at the methods available to Array and Enumerable in both
the Rails and Ruby apis.
--
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.