Skip to content

Instantly share code, notes, and snippets.

@ratnikov
Forked from maletor/gist:780007
Created January 14, 2011 18:37
Show Gist options
  • Select an option

  • Save ratnikov/780015 to your computer and use it in GitHub Desktop.

Select an option

Save ratnikov/780015 to your computer and use it in GitHub Desktop.
class Admin::AuditsController < ApplicationController
def create
@audit = Audit.new params[:audit]
if @audit.valid?
# ...
else
render :action => 'new'
end
end
end
class Audit < ActiveRecord::RecordWithoutBase
validates_format_of :start_date, :with => ...
validates_format_of :end_date, :with => ...
def versions
accounts= Account.with_role(Role.find_by_name("admin"))
VestalVersions::Version.order("created_at desc").where(:user_id => accounts, :created_at => start_date..end_date)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment