Skip to content

Instantly share code, notes, and snippets.

View MartinMcDermid's full-sized avatar

Martin McDermid MartinMcDermid

View GitHub Profile
<%= simple_form_for(@notification) do |f| %>
<%= f.error_notification %>
<div class="container">
<div class="col-md-12">
<h1>Create Notification</h1>
<div class="form-inputs">
<h5>Message</h5>
class LotteriesController < ApplicationController
def index
@lotteries = Lottery.paginate(:page => params[:page], :per_page => 5, :order => 'created_at desc, id')
# @lotteries = Lottery.find(:all, :conditions => ["completed = ?", false])
@completed_lotteries = Lottery.find(:all, :conditions => ["completed = ?", true])
#@tickets = Ticket.find(:all, :conditions => ["lottery_id = ?", params[:id]])
#@tickets = Ticket.all
end
def show
class Lottery < ActiveRecord::Base
attr_accessible :product_id, :completed, :tickets_attributes
belongs_to :product
has_many :tickets
accepts_nested_attributes_for :tickets, :allow_destroy => true
end
companies = Company.create([
{ name: 'Ultimate Fighting Championship'},
{ name: 'Strikeforce'},
{ name: 'Bellator Fighting Championships'},
{ name: 'EliteXC'},
{ name: 'DREAM'},
{ name: 'Pride FC'},
{ name: 'WEC'},
{ name: 'International Fight League'},