[Rails] Re: Is this thing here a helper or a model, or something else?

2011-01-13 Thread Jade Tucker
I was thinking about this problem as it is very interesting to myself being a relatively new ruby/rails programmer. How about opening and extending the range method to handle stepping through DateTimes. Not sure how to do this, but heres the idea: span = DateTime.parse("2011-01-13 12:00:00")...D

[Rails] Re: Is this thing here a helper or a model, or something else?

2011-01-13 Thread Marnen Laibow-Koser
Arailsdemo A. wrote in post #974689: > If you haven't worked with the lib/ directory before, make sure you have > > config.autoload_paths += %W(#{config.root}/lib) > > in config/application.rb Or not. You can also require your lib files explicitly if you'd rather, though autoloading is *

[Rails] Re: Is this thing here a helper or a model, or something else?

2011-01-13 Thread Arailsdemo A.
If you haven't worked with the lib/ directory before, make sure you have config.autoload_paths += %W(#{config.root}/lib) in config/application.rb Also, if you ever want to make yourself a gem, you could do something like # lib/acts_as_chunky_time module ActsAsChunkyTime def self.inc

[Rails] Re: Is this thing here a helper or a model, or something else?

2011-01-13 Thread Manuel Kiessling
Thanks guys, just learnt another "Ruby way" of doing stuff, you helped a lot! Arailsdemo: "chunk" is a much better fitting name for what I'm planning to implement, thanks for this. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Googl

[Rails] Re: Is this thing here a helper or a model, or something else?

2011-01-13 Thread Arailsdemo A.
These methods are not generating any HTML, so they should not be in a view helper. Like you said, they are not needed for controller function, so they shouldn't be in the ApplicationController. So I would put them in your model. You can put this logic in a module in your lib/ directory. This way i

[Rails] Re: Is this thing here a helper or a model, or something else?

2011-01-13 Thread Marnen Laibow-Koser
Manuel Kiessling wrote in post #974606: > Hello, > > for my Rails application I'm going to need a class that does timestamp > computations, e.g. "give me a list of all 5-minute-blocks for a certain > time range". > > Example: > > .set_start_time('2011-01-13 12:00:00') > .set_end_time('2011-01-13 12