Displaying 3 results from an estimated 3 matches for "record2".
Did you mean:
record
2007 May 06
1
validates_uniqueness_of (with :scope) doesn't seem to work?
...#39;'s the declaration in the Agycode.rb
validates_uniqueness_of *:descr*,
*:scope* => "project_id"
Here''s the test that SHOULDN''T pass but it does
*def* test_should_fail_duplicate_descr
record1 = *@project*.agycodes.*new*(*:descr* => "description")
record2 = record1
assert record1.save, "Save Record"
assert_valid(record1)
assert record2.save, "Save Record"
assert_valid(record2)
*end*
By the way, do you know how one would write the opposite of "assert_valid"?
Thank you,
David
--~--~---------~--~----~------------~-------...
2008 Sep 23
3
Finding distinct months using find_by_sql
...ollowing problem that has so far stumped me.
I''m trying to get the distinct months (and years) from a date field to
display as a list in a view. For example, there might be a number of
records stored with dates in the table ''headlines'':
name date
record1 21-09-2008
record2 15-09-2008
record3 03-08-2008
record4 02-08-2008
record5 12-07-2008
etc.
From which I''d like to get all distinct years and months to display in
a view something like what might be seen under the ''Archives'' section
of a blog page, like this:
September 2008
August...
2006 Jul 20
11
3 columns
Hi all,
Not really sure what to put in the title so hope people still open this!
What I want to do is produce something like this
Col1 Col2 Col3
data1 data2 data3
data4 data5 data6
data7 data8 data9
data.. data.. data..
data.. data.. data..
data-n data-n+1 data-n+2
I can get the data back from my db