nanaya wrote in post #1183805:
> Hi
>
> On Sat, Jun 4, 2016, at 04:16, Rynn Steinbolt wrote:
>>
>> end
>> end
>>
>
> You need to initialize data variable before doing the loop (`data =
> []`).
>
> def self.process_raw_data
> data = []
> find_each do |raw|
> data << ProcessedDatum.create(period_label: raw.status)
> end
>
> data
> end
Beautiful, thank you! Works like a charm and is indeed much more elegant
than my code.
--
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/a50e750291d2b9475b67883d1037b0bc%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment