Hi I have an attribute decimal => hour If I do hours.each do |h| h.my_hour end I get => 20.0 0.0 0.0 10.0 And this.. myhour = [] hours.each do |h| myhour << hour end myhour.join(",") I get => <Hour:0x007f81feec3330>,#<Hour:0x007f81feaa0c30>, How do I get something like this ? 20.0, 0.0, 0.0, 10.0 Thanks for support -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/6DIGUJ7JlhoJ. For more options, visit https://groups.google.com/groups/opt_out.
override Hour''s to_s method to return my_hour -- Dheeraj Kumar On Wednesday 27 February 2013 at 5:53 PM, Werner wrote:> Hi > I have an attribute decimal => hour > > If I do > > hours.each do |h| > h.my_hour > end > I get => 20.0 0.0 0.0 10.0 > > And this.. > myhour = [] > hours.each do |h| > myhour << hour > end > myhour.join(",") > > I get => > <Hour:0x007f81feec3330>,#<Hour:0x007f81feaa0c30>, > > How do I get something like this ? > 20.0, 0.0, 0.0, 10.0 > > Thanks for support > > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org (mailto:rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org). > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org (mailto:rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org). > To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/6DIGUJ7JlhoJ. > For more options, visit https://groups.google.com/groups/opt_out. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Thanks..but mhhh..it is not clear what you mean... hour.join(",").to_s ????? no effect.. Am Mittwoch, 27. Februar 2013 13:31:21 UTC+1 schrieb Dheeraj Kumar:> > override Hour''s to_s method to return my_hour > > -- > Dheeraj Kumar > > On Wednesday 27 February 2013 at 5:53 PM, Werner wrote: > > Hi > I have an attribute decimal => hour > > If I do > > hours.each do |h| > h.my_hour > end > I get => 20.0 0.0 0.0 10.0 > > And this.. > myhour = [] > hours.each do |h| > myhour << hour > end > myhour.join(",") > > I get => > <Hour:0x007f81feec3330>,#<Hour:0x007f81feaa0c30>, > > How do I get something like this ? > 20.0, 0.0, 0.0, 10.0 > > Thanks for support > > -- > 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-ta...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. > To post to this group, send email to rubyonra...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<javascript:> > . > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/6DIGUJ7JlhoJ. > For more options, visit https://groups.google.com/groups/opt_out. > > > > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/A6ElnCbknvMJ. For more options, visit https://groups.google.com/groups/opt_out.
Matt''s On Wed, Feb 27, 2013 at 9:43 AM, Werner <webagentur.laude-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>wrote:> Thanks..but > mhhh..it is not clear what you mean... > > hour.join(",").to_s ????? > no effect.. > > > Am Mittwoch, 27. Februar 2013 13:31:21 UTC+1 schrieb Dheeraj Kumar: >> >> override Hour''s to_s method to return my_hour >> >> -- >> Dheeraj Kumar >> >> On Wednesday 27 February 2013 at 5:53 PM, Werner wrote: >> >> Hi >> I have an attribute decimal => hour >> >> If I do >> >> hours.each do |h| >> h.my_hour >> end >> I get => 20.0 0.0 0.0 10.0 >> >> And this.. >> myhour = [] >> hours.each do |h| >> myhour << hour >> >> Here is the problem:myhour << h.my_hours> end >> myhour.join(",") >> >> I get => >> <Hour:0x007f81feec3330>,#<**Hour:0x007f81feaa0c30>, >> >> How do I get something like this ? >> 20.0, 0.0, 0.0, 10.0 >> >> Thanks for support >> >> -- >> 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-ta...@**googlegroups.com. >> To post to this group, send email to rubyonra...@googlegroups.**com. >> >> To view this discussion on the web visit https://groups.google.com/d/** >> msg/rubyonrails-talk/-/**6DIGUJ7JlhoJ<https://groups.google.com/d/msg/rubyonrails-talk/-/6DIGUJ7JlhoJ> >> . >> For more options, visit https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >> . >> >> >> >> >> -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/A6ElnCbknvMJ. > > For more options, visit https://groups.google.com/groups/opt_out. > > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Well my be I am a litte stubborn today.. What I need is an array [20.0, 0.0, 0.0, 10.0] Am Mittwoch, 27. Februar 2013 14:13:09 UTC+1 schrieb Carlos Mathiasen:> > > > Matt''s > > > On Wed, Feb 27, 2013 at 9:43 AM, Werner <webagent...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org<javascript:> > > wrote: > >> Thanks..but >> mhhh..it is not clear what you mean... >> >> hour.join(",").to_s ????? >> no effect.. >> >> >> Am Mittwoch, 27. Februar 2013 13:31:21 UTC+1 schrieb Dheeraj Kumar: >>> >>> override Hour''s to_s method to return my_hour >>> >>> -- >>> Dheeraj Kumar >>> >>> On Wednesday 27 February 2013 at 5:53 PM, Werner wrote: >>> >>> Hi >>> I have an attribute decimal => hour >>> >>> If I do >>> >>> hours.each do |h| >>> h.my_hour >>> end >>> I get => 20.0 0.0 0.0 10.0 >>> >>> And this.. >>> myhour = [] >>> hours.each do |h| >>> myhour << hour >>> >>> Here is the problem: > myhour << h.my_hours > >> end >>> myhour.join(",") >>> >>> I get => >>> <Hour:0x007f81feec3330>,#<**Hour:0x007f81feaa0c30>, >>> >>> How do I get something like this ? >>> 20.0, 0.0, 0.0, 10.0 >>> >>> Thanks for support >>> >>> -- >>> 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-ta...@**googlegroups.com. >>> To post to this group, send email to rubyonra...@googlegroups.**com. >>> >>> To view this discussion on the web visit https://groups.google.com/d/** >>> msg/rubyonrails-talk/-/**6DIGUJ7JlhoJ<https://groups.google.com/d/msg/rubyonrails-talk/-/6DIGUJ7JlhoJ> >>> . >>> For more options, visit https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >>> . >>> >>> >>> >>> >>> -- >> 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-ta...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. >> To post to this group, send email to rubyonra...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<javascript:> >> . >> To view this discussion on the web visit >> https://groups.google.com/d/msg/rubyonrails-talk/-/A6ElnCbknvMJ. >> >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/VtO0YOhzdW0J. For more options, visit https://groups.google.com/groups/opt_out.
this work for me: hours.collect{|h| h.my_hour} Matt''s On Wed, Feb 27, 2013 at 10:25 AM, Werner <webagentur.laude-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>wrote:> Well my be I am a litte stubborn today.. > What I need is an array > > [20.0, 0.0, 0.0, 10.0] > > > > > Am Mittwoch, 27. Februar 2013 14:13:09 UTC+1 schrieb Carlos Mathiasen: >> >> >> >> Matt''s >> >> >> On Wed, Feb 27, 2013 at 9:43 AM, Werner <webagent...@googlemail.**com>wrote: >> >>> Thanks..but >>> mhhh..it is not clear what you mean... >>> >>> hour.join(",").to_s ????? >>> no effect.. >>> >>> >>> Am Mittwoch, 27. Februar 2013 13:31:21 UTC+1 schrieb Dheeraj Kumar: >>>> >>>> override Hour''s to_s method to return my_hour >>>> >>>> -- >>>> Dheeraj Kumar >>>> >>>> On Wednesday 27 February 2013 at 5:53 PM, Werner wrote: >>>> >>>> Hi >>>> I have an attribute decimal => hour >>>> >>>> If I do >>>> >>>> hours.each do |h| >>>> h.my_hour >>>> end >>>> I get => 20.0 0.0 0.0 10.0 >>>> >>>> And this.. >>>> myhour = [] >>>> hours.each do |h| >>>> myhour << hour >>>> >>>> Here is the problem: >> myhour << h.my_hours >> >>> end >>>> myhour.join(",") >>>> >>>> I get => >>>> <Hour:0x007f81feec3330>,#<**Hour**:0x007f81feaa0c30>, >>>> >>>> How do I get something like this ? >>>> 20.0, 0.0, 0.0, 10.0 >>>> >>>> Thanks for support >>>> >>>> -- >>>> 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-ta...@**googlegroups**.com. >>>> To post to this group, send email to rubyonra...@googlegroups.**com. >>>> >>>> To view this discussion on the web visit https://groups.google.com/d/** >>>> ms**g/rubyonrails-talk/-/**6DIGUJ7Jl**hoJ<https://groups.google.com/d/msg/rubyonrails-talk/-/6DIGUJ7JlhoJ> >>>> . >>>> For more options, visit https://groups.google.com/**grou**ps/opt_out<https://groups.google.com/groups/opt_out> >>>> . >>>> >>>> >>>> >>>> >>>> -- >>> 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-ta...@**googlegroups.com. >>> To post to this group, send email to rubyonra...@googlegroups.**com. >>> To view this discussion on the web visit https://groups.google.com/d/** >>> msg/rubyonrails-talk/-/**A6ElnCbknvMJ<https://groups.google.com/d/msg/rubyonrails-talk/-/A6ElnCbknvMJ> >>> . >>> >>> For more options, visit https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >>> . >>> >>> >>> >> >>-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
or hours.map(&:my_hour) -- Dheeraj Kumar On Wednesday 27 February 2013 at 6:57 PM, Carlos Mathiasen wrote:> this work for me: > > hours.collect{|h| h.my_hour} > > > Matt''s > > On Wed, Feb 27, 2013 at 10:25 AM, Werner <webagentur.laude-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org (mailto:webagentur.laude-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org)> wrote: > > Well my be I am a litte stubborn today.. > > What I need is an array > > > > [20.0, 0.0, 0.0, 10.0] > > > > > > > > > > Am Mittwoch, 27. Februar 2013 14:13:09 UTC+1 schrieb Carlos Mathiasen: > > > > > > > > > Matt''s > > > > > > On Wed, Feb 27, 2013 at 9:43 AM, Werner <webagent...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > > Thanks..but > > > > mhhh..it is not clear what you mean... > > > > > > > > hour.join(",").to_s ????? > > > > no effect.. > > > > > > > > > > > > Am Mittwoch, 27. Februar 2013 13:31:21 UTC+1 schrieb Dheeraj Kumar: > > > > > override Hour''s to_s method to return my_hour > > > > > > > > > > -- > > > > > Dheeraj Kumar > > > > > > > > > > > > > > > On Wednesday 27 February 2013 at 5:53 PM, Werner wrote: > > > > > > > > > > > > > > > > Hi > > > > > > I have an attribute decimal => hour > > > > > > > > > > > > If I do > > > > > > > > > > > > hours.each do |h| > > > > > > h.my_hour > > > > > > end > > > > > > I get => 20.0 0.0 0.0 10.0 > > > > > > > > > > > > And this.. > > > > > > myhour = [] > > > > > > hours.each do |h| > > > > > > myhour << hour > > > Here is the problem: > > > myhour << h.my_hours > > > > > > > > > > > > end > > > > > > myhour.join(",") > > > > > > > > > > > > I get => > > > > > > <Hour:0x007f81feec3330>,#<Hour:0x007f81feaa0c30>, > > > > > > > > > > > > How do I get something like this ? > > > > > > 20.0, 0.0, 0.0, 10.0 > > > > > > > > > > > > Thanks for support > > > > > > > > > > > > -- > > > > > > 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-ta...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > > > To post to this group, send email to rubyonra...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > > > > > > > > > To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/6DIGUJ7JlhoJ. > > > > > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > > > > > > > > > > > > > > > > -- > > > > 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-ta...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > To post to this group, send email to rubyonra...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/A6ElnCbknvMJ. > > > > > > > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > > > > > > > > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org (mailto:rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org). > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org (mailto:rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org). > For more options, visit https://groups.google.com/groups/opt_out. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
After chaning the datatype to integer.. yes..works but as decimal (6,2) stays : <Hour:0x007f81feec3330>,#<Hour:0x007f81feaa0c30>, Thanks so far Am Mittwoch, 27. Februar 2013 14:31:46 UTC+1 schrieb Dheeraj Kumar:> > or > > hours.map(&:my_hour) > > -- > Dheeraj Kumar > > On Wednesday 27 February 2013 at 6:57 PM, Carlos Mathiasen wrote: > > this work for me: > > hours.collect{|h| h.my_hour} > > > Matt''s > > > On Wed, Feb 27, 2013 at 10:25 AM, Werner <webagent...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org<javascript:> > > wrote: > > Well my be I am a litte stubborn today.. > What I need is an array > > [20.0, 0.0, 0.0, 10.0] > > > > > Am Mittwoch, 27. Februar 2013 14:13:09 UTC+1 schrieb Carlos Mathiasen: > > > > Matt''s > > > On Wed, Feb 27, 2013 at 9:43 AM, Werner <webagent...@googlemail.**com>wrote: > > Thanks..but > mhhh..it is not clear what you mean... > > hour.join(",").to_s ????? > no effect.. > > > Am Mittwoch, 27. Februar 2013 13:31:21 UTC+1 schrieb Dheeraj Kumar: > > override Hour''s to_s method to return my_hour > > -- > Dheeraj Kumar > > On Wednesday 27 February 2013 at 5:53 PM, Werner wrote: > > Hi > I have an attribute decimal => hour > > If I do > > hours.each do |h| > h.my_hour > end > I get => 20.0 0.0 0.0 10.0 > > And this.. > myhour = [] > hours.each do |h| > myhour << hour > > Here is the problem: > myhour << h.my_hours > > end > myhour.join(",") > > I get => > <Hour:0x007f81feec3330>,#<**Hour**:0x007f81feaa0c30>, > > How do I get something like this ? > 20.0, 0.0, 0.0, 10.0 > > Thanks for support > > -- > 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-ta...@**googlegroups**.com. > To post to this group, send email to rubyonra...@googlegroups.**com. > > To view this discussion on the web visit https://groups.google.com/d/**ms* > *g/rubyonrails-talk/-/**6DIGUJ7Jl**hoJ<https://groups.google.com/d/msg/rubyonrails-talk/-/6DIGUJ7JlhoJ> > . > For more options, visit https://groups.google.com/**grou**ps/opt_out<https://groups.google.com/groups/opt_out> > . > > > > > -- > 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-ta...@**googlegroups.com. > To post to this group, send email to rubyonra...@googlegroups.**com. > To view this discussion on the web visit https://groups.google.com/d/** > msg/rubyonrails-talk/-/**A6ElnCbknvMJ<https://groups.google.com/d/msg/rubyonrails-talk/-/A6ElnCbknvMJ> > . > > For more options, visit https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> > . > > > > > > -- > 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-ta...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. > To post to this group, send email to rubyonra...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<javascript:> > . > For more options, visit https://groups.google.com/groups/opt_out. > > > > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/VSqssQmg648J. For more options, visit https://groups.google.com/groups/opt_out.
On 27 February 2013 12:23, Werner <webagentur.laude-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> Hi > I have an attribute decimal => hour > > If I do > > hours.each do |h| > h.my_hour > end > I get => 20.0 0.0 0.0 10.0 > > And this.. > myhour = [] > hours.each do |h| > myhour << hourThat should be myhour << h.myhour though myhour is a very poor name for an array. It should be plural.> end > myhour.join(",") > > I get => > <Hour:0x007f81feec3330>,#<Hour:0x007f81feaa0c30>,That it because you are adding Hour objects into the array, not decimal objects. Colin> > How do I get something like this ? > 20.0, 0.0, 0.0, 10.0 > > Thanks for support > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/6DIGUJ7JlhoJ. > For more options, visit https://groups.google.com/groups/opt_out. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
Am 27.02.2013 um 16:05 schrieb Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>:> On 27 February 2013 12:23, Werner <webagentur.laude-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> Hi >> I have an attribute decimal => hour >> >> If I do >> >> hours.each do |h| >> h.my_hour >> end >> I get => 20.0 0.0 0.0 10.0 >> >> And this.. >> myhour = [] >> hours.each do |h| >> myhour << hour > > That should be > myhour << h.myhour > though myhour is a very poor name for an array. It should be plural. > >> end >> myhour.join(",") >> >> I get => >> <Hour:0x007f81feec3330>,#<Hour:0x007f81feaa0c30>, > > That it because you are adding Hour objects into the array, not decimal objects.o.k.. true.. Thanks> > Colin > >> >> How do I get something like this ? >> 20.0, 0.0, 0.0, 10.0 >> >> Thanks for support >> >> -- >> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> To view this discussion on the web visit >> https://groups.google.com/d/msg/rubyonrails-talk/-/6DIGUJ7JlhoJ. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> > > -- > You received this message because you are subscribed to a topic in the Google Groups "Ruby on Rails: Talk" group. > To unsubscribe from this topic, visit https://groups.google.com/d/topic/rubyonrails-talk/4Jd-ZJHdzAo/unsubscribe?hl=en-US. > To unsubscribe from this group and all its topics, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit https://groups.google.com/groups/opt_out. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On 27 February 2013 15:11, Werner Laude <webagentur.laude-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> > Am 27.02.2013 um 16:05 schrieb Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>: > >> On 27 February 2013 12:23, Werner <webagentur.laude-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >>> Hi >>> I have an attribute decimal => hour >>> >>> If I do >>> >>> hours.each do |h| >>> h.my_hour >>> end >>> I get => 20.0 0.0 0.0 10.0 >>> >>> And this.. >>> myhour = [] >>> hours.each do |h| >>> myhour << hour >> >> That should be >> myhour << h.myhour >> though myhour is a very poor name for an array. It should be plural. >> >>> end >>> myhour.join(",") >>> >>> I get => >>> <Hour:0x007f81feec3330>,#<Hour:0x007f81feaa0c30>, >> >> That it because you are adding Hour objects into the array, not decimal objects. > > o.k.. > true.. > > ThanksCarlos did point out the problem earlier. It is worth reading the answers carefully when you ask a question. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.