Dear list,
I got a database with two tables, 'bets' and 'matches'. When placing a bet, I would like to have a [Match number] dropdown menu listing the primary_key to all existing matches in the 'matches' table. This connecting the bet to a known upcoming match.
Would any of you gentlemen please give me some help?
app/views/bets/new.rhtml:
<% form_tag :action => 'create' do %> <%= render :partial => 'form' %> <%= submit_tag "Create" %> <% end %> <%= link_to 'Back', :action => 'list' %>
app/views/bets/_form.rhtml:
<!--[form:bet]--> <p><label for="bet_gambler">Gambler</label><br/> <%= text_field 'bet', 'gambler' %></p> <p><label for="bet_game">Game</label><br/> <%= text_field 'bet', 'game' %></p> <p><label for="bet_hjemme">Hjemme</label><br/> <%= text_field 'bet', 'hjemme' %></p> <p><label for="bet_borte">Borte</label><br/> <%= text_field 'bet', 'borte' %></p> <p><label for="bet_amount_of_money_placed">Amount of money placed</label><br/> <%= text_field 'bet', 'amount_of_money_placed' %></p> <!--[eoform:bet]-->
scheme.rb:
create_table "bets", :force => true do |t| t.column "gambler", :string t.column "game", :integer t.column "hjemme", :integer t.column "borte", :integer t.column "bet_placed_at", :datetime t.column "amount_of_money_placed", :integer end
create_table "matches", :force => true do |t| t.column "hjemmelag", :string t.column "bortelag", :string t.column "arena", :string t.column "date", :datetime t.column "goals_home", :decimal t.column "goals_away", :decimal end
end
All help is highly appreciated!
Best regards, Martin Stabenfeldt