extending

extending(*modules, &block) Instance Public methods Used to extend a scope with additional methods, either through a module or through a block provided. The object returned is a relation, which can be further extended. Using a module module Pagination def page(number) # pagination code goes here end end scope = Model.all.extending(Pagination) scope.page(params[:page]) You can also pass a list of modules: scope = Model.all.extending(Pagination, SomethingElse) Using a

bind

bind(context) Instance Public methods

between?

between?(min, max) Instance Public methods Returns true if the current object's time is within the specified min and max time.

skip_around_action

skip_around_action(names) Instance Public methods Skip a callback around actions. See #_insert_callbacks for parameter details. Aliased as skip_around_filter.

reset_cycle

reset_cycle(name = "default") Instance Public methods Resets a cycle so that it starts from the first element the next time it is called. Pass in name to reset a named cycle. # Alternate CSS classes for even and odd numbers... @items = [[1,2,3,4], [5,6,3], [3,4,5,6,7,4]] <table> <% @items.each do |item| %> <tr class="<%= cycle("even", "odd") -%>"> <% item.each do |value| %> <span style="color:<%= cycle("#333", "#666", "#999", name

select_values

select_values(arel, name = nil) Instance Public methods Returns an array of the values of the first column in a select: select_values("SELECT id FROM companies LIMIT 3") => [1,2,3]

behavior

behavior() Instance Public methods Returns the current behavior or if one isn't set, defaults to :stderr.

initialized?

initialized?() Instance Public methods Returns true if the application is initialized.

ip

ip() Instance Public methods

disconnect!

disconnect!() Instance Public methods Disconnects from the database if already connected. Otherwise, this method does nothing.