Displaying 6 results from an estimated 6 matches for "contact_info".
2007 Jun 21
1
Validation Through Multiple Models from one Form
...e models.
I have
class Man < ActiveRecord::Base
has_many :notes
has_many :contacts
validates_associated :contacts, :notes
validates_presence_of :first_name
validates_presence_of :last_name
class Contact < ActiveRecord::Base
belongs_to :man
validates_presence_of :contact_info
class Note < ActiveRecord::Base
belongs_to :man
validates_presence_of :notes
However when I submit the form blank, it will only validate for the Man
model. Not the other two. If I fill in the form then the data gets
submitted to the DB tables just fine, it just will not validate mor...
2009 Oct 07
2
"Overriding" association build methods
Hey everyone
I have (in a nutshell) two models: Customer and Order. Customer
has_many Orders and Order belongs_to Customer. The Order model
contains fields such as name, address and phone that mirror the
associated Customer''s fields at the time the order was placed. The
reason for this is that if the customer changes their details then the
order contains the details that were current
2007 Mar 17
3
How is this done with REST (blinksale account)?
In Blinksale, the settings link in the top right takes you to the /
account url. From there, the side nav takes you to /account;templates /
account;reminders , etc.
>From what I''ve read, ;templates and ;reminders are custom rest actions
for a given resource. But the controller (account) does not appear to
be of rest nature. Also, when creating a new account, the url is /
firms/new .
2006 Dec 08
9
How to update partial attributes of a object from a form?
I have a user table, and it has forty columns, including name, gender,
address, email, phone...
So my @user object will have forty attributes.
I divide these attributes into 4 groups... namely ''general info'',
''personal info'', ''contact info''... and I make separate forms to edit
these 4 different group attributes.
The problem is when I update
2007 Dec 29
0
should send_email always succeeds?
I wrote the following in my spec:
emails = ActionMailer::Base.deliveries
emails.length.should eql(2)
response.should send_email {
with_tag(''tr'', @contact_info[:full_name])
}
knowing that 1) an email is being sent; and 2) the contact info is in
a ''p'' tag and only in a ''p'' tag. The length expectation is met --
there are two emails. The send_email expectation is met, but should
not be, as the correct tag would...
2007 Sep 04
16
Failure Messages in RSpec
Having used JUnit and Test::Unit, I''m quite used to having the ability to
insert a failure message, which helps when tests fail.
For instance, the example RSpec that is generated for a model class
specifies that the model class is valid. Assuming this were supposed to be
true, and it failed, I''ve now got to duplicate the code in the test in order
to find out why it