#11 new
Glen Barnes

Constraining Attributes Giving Incorrect Results

Reported by Glen Barnes | July 23rd, 2008 @ 06:24 AM

Given this file:

Attendance.seed(:user_id, :event_id, :attendance_type_id) do |s|

s.user_id = 1,

s.event_id = 1,

s.attendance_type_id = AttendanceType::PRESENTER.id

s.bio = "Foo..."


Attendance.seed(:user_id, :event_id, :attendance_type_id) do |s|

s.user_id = 2,

s.event_id = 1,

s.attendance_type_id = AttendanceType::PRESENTER.id

s.bio = "bar..."


Running it gives this output:

== [development] Seeding from attendance.rb ================

  • Attendance {:event_id=>1, :user_id=>[1, 1, 3], :attendance_type_id=>3}
  • Attendance {:event_id=>1, :user_id=>[2, 1, 3], :attendance_type_id=>3}

And the count is:

>> Attendance.count

=> 1

It seems that :user_id is not being populated correctly (Shoulfin't it be :user_id=>1 and :user_id=>2 in the above example?

Any ideas on if this is a bug or am I doing something wrong here?



No comments found

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

An attempt to simplify the usage of seed data in Rails applications through a dead simple API.

People watching this ticket