[Rails] Re: Foreign keys in YAML fixtures
——=_Part_29323_22437120.1192322747695
Content-Type: text/plain; charset=ISO-8859-1
Hi Stephan,
Thanks for the response, I apologize for the delay in my response, I only
have time to work on RoR on the weekends. I do have a users file. I have
included the text below. As far as ordering, will the ordering plugin be
implicitly executed when I run my rake file, or will I have to manually run
the target?
Thanks,
Todd
quentin:
id: 1
login: quentin
email: quentin@example.com
salt: 7e3041ebc2fc05a40c60028e2c4901a81035d3cd
crypted_password: 00742970dc9e6319f8019fd54864d3ea740f04b1 # test
#crypted_password: “ce2/iFrNtQ8=\n” # quentin, use only if you’re using
2-way encryption
created_at:
activated_at: # only if you’re activating new
signups
enabled:
aaron:
id: 2
login: aaron
email: aaron@example.com
salt: 7e3041ebc2fc05a40c60028e2c4901a81035d3cd
crypted_password: 00742970dc9e6319f8019fd54864d3ea740f04b1 # test
activation_code: aaronscode # only if you’re activating new signups
created_at:
enabled:
disabled:
id: 3
login: disabled
email: disabled@example.com
salt: 7e3041ebc2fc05a40c60028e2c4901a81035d3cd
crypted_password: 00742970dc9e6319f8019fd54864d3ea740f04b1 # test
#crypted_password: “ce2/iFrNtQ8=\n” # quentin, use only if you’re using
2-way encryption
created_at:
activated_at: # only if you’re activating new
signups
enabled:
On 10/10/07, Stephan Wehner wrote:
>
>
> Todd Nine wrote:
> > Hi all,
> > I’m trying to set up my test fixtures, and I’ve recently added foreign
> > keys to my database. Each “channel” is owned by a user, so I need to
> > include a valid user id with each fixture. I’m not sure how to set this
> > up. My YAML is the following
> >
> > eBay:
> > id: 1
> > name: eBay
> > created_at:
> > user_id:
> > antiqueStore:
> > id: 2
> > name: antique Store
> > created_at:
> > user_id:
>
>
> You have a users.yaml file? If not, you need one!
>
> Usually the user_id:… lines would read
>
> user_id: 4 # some definite number
>
> where you have a user in the users.yaml file with id 4 (or some other
> definite number).
>
> >
> > Nothing is inserted into the user table, so the above obviously won’t
> > work.
> > How can I run my users.yaml file when I run my channels test?
>
>
> See
>
> http://alistairisrael.wordpress.com/2007/07/27/bootstrapping-your-database-with-ordered-fixtures/
>
> >
>
> > Thanks,
> > Todd
>
> –
> Posted via http://www.ruby-forum.com/.
>
> >
>
–~–~———~–~—-~————~——-~–~—-~
You received this message because you are subscribed to the Google Groups “Ruby on Rails: Talk” group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~———-~—-~—-~—-~——~—-~——~–~—
——=_Part_29323_22437120.1192322747695
Content-Type: text/html; charset=ISO-8859-1
Hi Stephan,
Thanks for the response, I apologize for the delay in my response, I only have time to work on RoR on the weekends. I do have a users file. I have included the text below. As far as ordering, will the ordering plugin be implicitly executed when I run my rake file, or will I have to manually run the target?
Thanks,
Todd
quentin:
id: 1
login: quentin
email: quentin@example.com
salt: 7e3041ebc2fc05a40c60028e2c4901a81035d3cd
crypted_password: 00742970dc9e6319f8019fd54864d3ea740f04b1 # test
#crypted_password: "ce2/iFrNtQ8=\n" # quentin, use only if you're using 2-way encryption
created_at: <%= 5.days.ago.to_s :db %>
activated_at: <%= 5.days.ago.to_s :db %> # only if you're activating new signups
enabled: <%= true %>
aaron:
id: 2
login: aaron
email: aaron@example.com
salt: 7e3041ebc2fc05a40c60028e2c4901a81035d3cd
crypted_password: 00742970dc9e6319f8019fd54864d3ea740f04b1 # test
activation_code: aaronscode # only if you're activating new signups
created_at: <%= 1.days.ago.to_s :db %>
enabled: <%= true %>
disabled:
id: 3
login: disabled
email:
disabled@example.com
salt: 7e3041ebc2fc05a40c60028e2c4901a81035d3cd
crypted_password: 00742970dc9e6319f8019fd54864d3ea740f04b1 # test
#crypted_password: "ce2/iFrNtQ8=\n" # quentin, use only if you're using 2-way encryption
created_at: <%= 5.days.ago.to_s :db %>
activated_at: <%= 5.days.ago.to_s :db %> # only if you're activating new signups
enabled: <%= false %>
Stephan Wehner <rails-mailing-list@andreas-s.net> wrote:
Todd Nine wrote:
> Hi all,
> I'm trying to set up my test fixtures, and I've recently added foreign
> keys to my database. Each "channel" is owned by a user, so I need to
> include a valid user id with each fixture. I'm not sure how to set this
> up. My YAML is the following
>
> eBay:
> id: 1
> name: eBay
> created_at: <%= 5.days.ago.to_s :db %>
> user_id: <%= User.find_by_login("quentin") %>
> antiqueStore:
> id: 2
> name: antique Store
> created_at: <%= 5.days.ago.to_s :db %>
> user_id: <%= User.find_by_login("quentin") %>You have a users.yaml
file? If not, you need one!Usually the user_id:… lines would read
user_id: 4 # some definite number
where you have a user in the users.yaml file with id 4 (or some other
definite number).>
> Nothing is inserted into the user table, so the above obviously won't
> work.
> How can I run my users.yaml file when I run my channels test?See
http://alistairisrael.wordpress.com/2007/07/27/bootstrapping-your-database-with-ordered-fixtures/>
> Thanks,
> Todd–
Posted via http://www.ruby-forum.com/
.
–~–~———~–~—-~————~——-~–~—-~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~———-~—-~—-~—-~——~—-~——~–~—
——=_Part_29323_22437120.1192322747695–
.