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.included(class_thats_including_my_module)
    class_thats_including_my_module.extend ClassMethods
  end

  module ClassMethods
    def acts_as_chunky_time
      include ActsAsChunkyTime::InstanceMethods
    end
  end

  module InstanceMethods
    def set_start_time ...
    def set_end_time ...
    def get_time_blocks ...
  end
end

ActiveRecord::Base.send(:include, ActsAsChunkyTime)


# my_model.rb

class MyModel < AR::Base
  acts_as_chunky_time
end




Manuel Kiessling wrote in post #974620:
> 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 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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to