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
mickael@mickael-laptop:~/projects/pabd$ script/console | |
Loading development environment (Rails 2.3.5) | |
>> Assignment.last | |
=> #<Assignment id: 5, agency_id: 1, account_id: 2, created_at: "2010-05-14 12:17:12", updated_at: "2010-05-14 12:17:12", account_type_id: 2> | |
>> AccountType.find(2) | |
=> #<AccountType id: 2, name: "Petit Compte", created_at: "2010-05-14 12:10:33", updated_at: "2010-05-14 12:10:33", deleted_at: nil> | |
>> AccountType.find(2).destroy | |
=> #<AccountType id: 2, name: "Petit Compte", created_at: "2010-05-14 12:10:33", updated_at: "2010-05-14 12:10:33", deleted_at: "2010-05-14 12:43:20"> | |
>> AccountType.find(2) | |
ActiveRecord::RecordNotFound: Couldn't find AccountType with ID=2 |
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 Division < ActiveRecord::Base | |
has_many :agencies, :dependent => :destroy | |
belongs_to :country | |
validates_presence_of :name, :country | |
validates_uniqueness_of :name, :case_sensitive => false | |
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
# Generate generic tests for instance and unsaved objects | |
# object as String | |
# uniqueness_attr as Array | |
# model_generic_tests("account", %w(name)) | |
def model_generic_tests(object, uniqueness_attr=[]) | |
context "A #{object} instance" do | |
setup do | |
@object = Factory(object.to_sym) | |
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
UserProfile Model | |
xapit do |index| | |
index.text :first_name, :last_name | |
index.facet :diploma_skill | |
index.facet :trainings_translation_title | |
index.facet :first_name | |
index.facet :last_name | |
end |
NewerOlder