Ruby on Rails Sunday, January 30, 2011

justinbaker wrote in post #978517:
> First off..this isn't valid ruby.
>
> class EventRoster{
> @events = []
> @event_occurrences = []
> }
>
> try
> class EventRoster
> def initialize
> @events = []
> @event_occurrences = []
> end
> end

Thank you, Justin, for your valued input. Unfortunately, I wasn't
attempting to provide valid Ruby--I was trying to show ruby-ish
pseudocode that showed a quick overview of the information that was
needed in order to ask my question.

class EventRoster contains about 30 methods for dealing with events, and
far more instance variables. 90% of this code is irrelevant to the
question being asked, so I simply gave an overview.

But again, thank you VERY much for your help. I will remember this in
the future, should I ever accidentally dump code directly into the class
instead of making a constructor.

Peace.

--
Posted via http://www.ruby-forum.com/.

--
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-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment