Displaying 5 results from an estimated 5 matches for "office_id".
Did you mean:
office_1
2006 Apr 26
1
Bug in validates_associated?
Here is the setup:
Windows XP, InstantRails, MySQL 14.7, Ruby 1.8.4, Rails 1.1.2
MODEL:
class Office<ActiveRecord::Base
has_many :users
end
class User<ActiveRecord::Base
belongs_to :office
validates_presence_of :office_id
validates_associated :office
<....other stuff...>
end
UNIT_TEST test/unit/user_test.rb
def test_associations
u = User.new
u.office_id = 2222 # Invalid office id
assert !u.save # Expected because of the invalid office id
u.office_id = 2 # Valid office ID, foun...
2009 Apr 10
1
ActiveRecord question
...et''s say I have:
class Office
has_many :holidays #(just a list of dates when the office is closed)
has_many :doctors #doctors who work in the office
end
class Doctor
belongs_to :office
has_many :holidays #(additional dates when this doctor is not
available)
end
class Holiday (has a office_id, doctor_id and a date field)
end
From the app standpoint I would like to be able to allow the
administrator to set office-wide closed dates, but to allow an
individual doctor to augment that list with additional dates he/she
won''t be available in.
What is the best/most elegant way to ret...
2006 Jan 04
0
thsi is my first question
...t; Company
Then there is another class called Region which is
class Region < ActiveRecord::Base
now there is many to many relationship between Vendor and Region and
there is many to many relationship between Office < Region and also in
Customer.
Now can I use vendor_id , customer_id and office_id as foreign key or
can only use company_id since the table for company is only 1 with
primary key id.
Thanks for help
Vikrant
2007 Nov 20
3
How to test views with Nested Resources and Partials
...@contract = mock_model(Contract)
@contract.stub!(:id).and_return("1")
@contract.stub!(:sdc_ref).and_return("MyString")
@contract.stub!(:description).and_return("MyString")
@contract.stub!(:sales_rep_id).and_return("1")
@contract.stub!(:office_id).and_return("1")
@contract.stub!(:account_id).and_return("MyString")
@contract.stub!(:cust_po_num).and_return("MyString")
@contract.stub!(:payment_terms).and_return("MyString")
@contract.stub!(:hp3000).and_return(false)
@contract.stub!(:re...
2005 Dec 29
9
Single Table Inheritance
Hi all,
Quick question for STI. With the following setup:
class Company < AR::Base; end
class Firm < Company; end
Why does Firm.find(:all) return all Companies, not just those that have
type==''Firm''?
--
Alex