This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= content_box "Create a New Product", :size => 75, :alt => true do %> | |
<%= semantic_form_for (@product ||= Product.new) do |f| %> | |
<%= f.inputs do %> | |
<%= f.input :name %> | |
<%= f.input :accounting_code %> | |
<%= f.commit_button :button_html => { :class => "button" } %> | |
<% end %> | |
<% end %> | |
<% end %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= semantic_form_for (@activity ||= Activity.new) do |f| %> | |
<%= f.inputs :name => "Quickly record what you did" do %> | |
<%= f.input :date, :selected => Date.today, :order => [:month, :day, :year] %> | |
<%= f.input :category, :collection => [ "Office", "Personal", "Sales" ], :label => "Type", :input_html => { :class => "change-form-options" } %> | |
<%= f.inputs :rel => "Sales" do %> | |
<%= f.input :contact_id, :as => :string %> | |
<% end %> | |
<%= f.input :notes %> | |
<%= f.inputs :rel => "Sales Office" do %> | |
<%= f.input :outcome, :collection => [ "In the bag", "Will get them with some effort", "50-50 chance no matter what we do", "Probably won't get their business", "Waste of time" ] %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s = Activity.search | |
# => #<MetaSearch::Builder:0x000001053b4588 @relation=[#<Activity id: 1... | |
s.date_gteq = Date.yesterday | |
# => Sun, 11 Jul 2010 | |
s.to_sql | |
# => "SELECT \"activities\".* FROM \"activities\" WHERE (\"activities\".\"date\" >= '2010-07-11')" | |
s.date_gteq = s.date_gteq.beginning_of_week |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Ability | |
include CanCan::Ability | |
def initialize(user) | |
if user.is? :admin | |
can :read, :all | |
can :manage, Activity, :user_id => [user.id, *user.asm_ids] | |
elsif user.is? :supervisor | |
can :manage, Activity, :user_id => [user.id, *user.asm_ids] | |
elsif user.is? :ASM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WillPaginate::ViewHelpers.pagination_options[:renderer] = "ProperPagination" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def index | |
@activities = current_user.activities.search(params[:search] | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'sqlite3-ruby', :require => 'sqlite3', :group => :development | |
gem 'mysql', :group => :production |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
can :read, Contact, :deleted_at => nil | |
#SELECT * FROM contacts WHERE (deleted_at IS NULL or deleted_at = "") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActiveRecord::StatementInvalid: PGError: ERROR: column "sales.id" must appear in the GROUP BY clause or be used in an aggregate function | |
: SELECT "sales".* FROM "sales" WHERE (branch_name = 'St. Joseph') AND ("sales"."invoiced_on" = '2010-08-09') GROUP BY date_part('year', invoiced_on) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contact.limit(5).search({ :deleted_at_is_blank => true }) | |
ActiveRecord::StatementInvalid: PGError: ERROR: invalid input syntax for type timestamp: "" | |
: SELECT "contacts".* FROM "contacts" WHERE (("contacts"."deleted_at" IS NULL OR "contacts"."deleted_at" = '')) LIMIT 5 |
OlderNewer