Yep....Cincy.  No much ruby here.  :(  Well, except for Jim Weirich and the 
Edgecase guys and a few freelancers.  Java pays the bills and ruby at night.

Good coding,

GregD



---- Scott LaBounty <[email protected]> wrote: 
> Greg,
> 
> Cool, I'll take a look at this.
> 
> As an aside, Euchre? You must be from the midwest somewhere. We used to play
> all the time in IL, but it's hard to find people out here, CA, to play.
> 
> Scott
> 
> On Wed, Aug 18, 2010 at 6:28 AM, Greg Ditrick <[email protected]> wrote:
> 
> > Scott,
> >
> > I use a seed.rb to seed the database and a rake task db:seed.  In my
> > seed.rb I use the model code.  I use this for configuration/mnemonic type
> > data.
> >
> > For example:
> >
> > >>>>>>>>
> > # This file should contain all the record creation needed to seed the
> > database with its default values.
> > # The data can then be loaded with the rake db:seed (or created alongside
> > the db with db:setup).
> > #
> > # Examples:
> > #
> > #   cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen'
> > }])
> > #   Major.create(:name => 'Daley', :city => cities.first)
> >
> > TournamentStatus.dataset.destroy
> > TournamentStatus.insert(:id => 10, :value => 'Pending', :description =>
> > 'Tournament created, invites sent, pending start.')
> > TournamentStatus.insert(:id => 20, :value => 'Running', :description =>
> > 'Tournament is actively running.')
> > TournamentStatus.insert(:id => 90, :value => 'Suspended', :description =>
> > 'Tournament is suspended until further notice.')
> > TournamentStatus.insert(:id => 100, :value => 'Finished', :description =>
> > 'Tournament has completed.')
> > TournamentStatus.insert(:id => 1000, :value => 'Cancelled', :description =>
> > 'Tournament has been cancelled.')
> >
> > TournamentType.dataset.destroy
> > TournamentType.insert(:id => 1,
> >                      :klass => EuchreTournamentType.name,
> >                      :description => 'Euchre Tournament',
> >                      :players_per_team => 2,
> >                      :teams_per_match => 2)
> > #TournamentType.insert(:id => 2, :klass => 'OnlineEuchreTournament',
> > :description => 'Online Euchre Tournament.')
> > TournamentType.insert(:id => 100,
> >                      :klass => CornholeTournamentType.name,
> >                      :description => 'Cornhole Tournament',
> >                      :players_per_team => 2,
> >                      :teams_per_match => 2)
> >
> > ScoringType.dataset.destroy
> > s = ScoringType[ScoringType.insert(:id => 100, :klass =>
> > 'TotalPointsScoringType', :description => 'Euchre Total Points')]
> > EuchreTournamentType.first.add_scoring_type(s)
> > s = ScoringType[ScoringType.insert(:id => 101, :klass =>
> > 'TimesEuchredScoringType', :description => 'Euchre Times Euchred')]
> > EuchreTournamentType.first.add_scoring_type(s)
> >
> > s = ScoringType[ScoringType.insert(:id => 200, :klass =>
> > 'TotalPointsScoringType', :description => 'Cornhole Total Points')]
> > CornholeTournamentType.first.add_scoring_type(s)
> > s = ScoringType[ScoringType.insert(:id => 201, :klass =>
> > 'TotalHolesScoringType', :description => 'Cornhole Holed Bags')]
> > CornholeTournamentType.first.add_scoring_type(s)
> > s = ScoringType[ScoringType.insert(:id => 202, :klass =>
> > 'TotalBoardsScoringType', :description => 'Cornhole Board Bags')]
> > CornholeTournamentType.first.add_scoring_type(s)
> >
> > <<<<<<
> >
> > Might not be the best way, but it works for me.   I'm setting up fixed
> > associations here, so that when a user selects a tournament type they will
> > get a set of scoring types and prize types.  Well, that is the idea.  Again,
> > this might not be the best way, but my app is a stand-alone app and a web
> > app and I want to make sure this data is consistent for both.
> >
> > I would do this in a seed.rb and use the Models.  Just my 2 cents.
> >
> >
> > GregD
> >
> >
> >
> > ---- Scott LaBounty <[email protected]> wrote:
> > > All
> > >
> > > I have the following migration ...
> > >
> > > <<
> > > # Sequel migration that creates the books, authors, and authors_books.
> > > Class.new(Sequel::Migration) do
> > >     def up
> > >         create_table(:books) do
> > >             primary_key :id
> > >             String :title
> > >         end
> > >
> > >         create_table(:authors) do
> > >             primary_key :id
> > >             String :first_name
> > >             String :last_name
> > >         end
> > >
> > >         create_table(:authors_books) do
> > >             primary_key :id
> > >             foreign_key :author_id, :authors
> > >             foreign_key :book_id, :books
> > >         end
> > >
> > >         # Create a library administrator.
> > >         from(:books).insert(:title => 'Programming Ruby')
> > >         from(:authors).insert(:first_name => 'Dave', :last_name =>
> > 'Thomas')
> > >
> > >     end
> > >
> > >     def down
> > >         drop_table(:books, :authors, :authors_books)
> > >     end
> > > end
> > >
> > > >>
> > >
> > > and I want to hook the book (Programming Ruby) with the author (Dave
> > Thomas)
> > > in the authors_books table. The documentation says not to use models
> > (pretty
> > > emphatically) which would be how I'd normally do this. Actually, I
> > wouldn't
> > > normally do this at all, this is just to save myself a bunch of
> > irrelevant
> > > coding elsewhere.
> > >
> > > Thoughts?
> > >
> > >
> > > --
> > > Scott
> > > http://steamcode.blogspot.com/
> > >
> > > --
> > > You received this message because you are subscribed to the Google Groups
> > "sequel-talk" group.
> > > To post to this group, send email to [email protected].
> > > To unsubscribe from this group, send email to
> > [email protected]<sequel-talk%[email protected]>
> > .
> > > For more options, visit this group at
> > http://groups.google.com/group/sequel-talk?hl=en.
> > >
> >
> 
> 
> 
> -- 
> Scott
> http://steamcode.blogspot.com/

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to