Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

update rails_admin

  • Loading branch information...
commit 374b1422e2d62595c737f5e3985fd138210cfe02 1 parent a2c1fdd
@bbenezech authored
Showing with 106 additions and 98 deletions.
  1. +53 −54 Gemfile.lock
  2. +34 −36 db/schema.rb
  3. +19 −8 db/seeds.rb
View
107 Gemfile.lock
@@ -1,9 +1,9 @@
GIT
remote: git://github.com/sferik/rails_admin.git
- revision: 76c6c10076733e5581eed7d7ab2a40ab621f2188
+ revision: 254018ed5c4bf8210e190a6a6622fc89012a41d8
specs:
rails_admin (0.0.1)
- bbenezech-nested_form (~> 0.0.5)
+ bbenezech-nested_form (~> 0.0.6)
bootstrap-sass (~> 2.0)
builder (~> 3.0)
coffee-rails (~> 3.1)
@@ -19,42 +19,42 @@ GIT
GEM
remote: http://rubygems.org/
specs:
- actionmailer (3.2.2)
- actionpack (= 3.2.2)
- mail (~> 2.4.0)
- actionpack (3.2.2)
- activemodel (= 3.2.2)
- activesupport (= 3.2.2)
+ actionmailer (3.2.3)
+ actionpack (= 3.2.3)
+ mail (~> 2.4.4)
+ actionpack (3.2.3)
+ activemodel (= 3.2.3)
+ activesupport (= 3.2.3)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.1)
rack (~> 1.4.0)
- rack-cache (~> 1.1)
+ rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.1.2)
- activemodel (3.2.2)
- activesupport (= 3.2.2)
+ activemodel (3.2.3)
+ activesupport (= 3.2.3)
builder (~> 3.0.0)
- activerecord (3.2.2)
- activemodel (= 3.2.2)
- activesupport (= 3.2.2)
+ activerecord (3.2.3)
+ activemodel (= 3.2.3)
+ activesupport (= 3.2.3)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
- activeresource (3.2.2)
- activemodel (= 3.2.2)
- activesupport (= 3.2.2)
- activesupport (3.2.2)
+ activeresource (3.2.3)
+ activemodel (= 3.2.3)
+ activesupport (= 3.2.3)
+ activesupport (3.2.3)
i18n (~> 0.6)
multi_json (~> 1.0)
- addressable (2.2.7)
arel (3.0.2)
- bbenezech-nested_form (0.0.5)
+ bbenezech-nested_form (0.0.6)
bcrypt-ruby (3.0.1)
- bootstrap-sass (2.0.1)
+ bootstrap-sass (2.0.2)
builder (3.0.0)
cancan (1.6.7)
- carrierwave (0.5.8)
- activesupport (~> 3.0)
+ carrierwave (0.6.2)
+ activemodel (>= 3.2.0)
+ activesupport (>= 3.2.0)
cocaine (0.2.1)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
@@ -62,34 +62,32 @@ GEM
coffee-script (2.2.0)
coffee-script-source
execjs
- coffee-script-source (1.2.0)
+ coffee-script-source (1.3.1)
devise (1.5.3)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.0.3)
warden (~> 1.1)
- dragonfly (0.9.11)
+ dragonfly (0.9.12)
rack
erubis (2.7.0)
- execjs (1.3.0)
+ execjs (1.3.1)
multi_json (~> 1.0)
- faraday (0.7.6)
- addressable (~> 2.2)
+ faraday (0.8.0)
multipart-post (~> 1.1)
- rack (~> 1.1)
- faraday_middleware (0.8.5)
+ faraday_middleware (0.8.7)
faraday (>= 0.7.4, < 0.9)
haml (3.1.4)
hike (1.2.1)
hpricot (0.8.6)
i18n (0.6.0)
journey (1.0.3)
- jquery-rails (2.0.1)
+ jquery-rails (2.0.2)
railties (>= 3.2.0, < 5.0)
thor (~> 0.14)
jquery-ui-rails (0.2.2)
jquery-rails
railties (>= 3.1.0)
- json (1.6.5)
+ json (1.7.0)
kaminari (0.13.0)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
@@ -98,16 +96,17 @@ GEM
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
- mime-types (1.17.2)
+ mime-types (1.18)
mini_magick (3.4)
subexec (~> 0.2.1)
- mlb (0.5.7)
- faraday (~> 0.7)
+ mlb (0.6.1)
+ faraday (~> 0.8)
faraday_middleware (~> 0.8)
- json (~> 1.6)
- multi_json (1.1.0)
+ json (~> 1.7)
+ multi_json (~> 1.3)
+ multi_json (1.3.4)
multipart-post (1.1.5)
- orm_adapter (0.0.6)
+ orm_adapter (0.0.7)
paperclip (2.7.0)
activerecord (>= 2.3.0)
activesupport (>= 2.3.2)
@@ -125,17 +124,17 @@ GEM
rack
rack-test (0.6.1)
rack (>= 1.0)
- rails (3.2.2)
- actionmailer (= 3.2.2)
- actionpack (= 3.2.2)
- activerecord (= 3.2.2)
- activeresource (= 3.2.2)
- activesupport (= 3.2.2)
+ rails (3.2.3)
+ actionmailer (= 3.2.3)
+ actionpack (= 3.2.3)
+ activerecord (= 3.2.3)
+ activeresource (= 3.2.3)
+ activesupport (= 3.2.3)
bundler (~> 1.0)
- railties (= 3.2.2)
- railties (3.2.2)
- actionpack (= 3.2.2)
- activesupport (= 3.2.2)
+ railties (= 3.2.3)
+ railties (3.2.3)
+ actionpack (= 3.2.3)
+ activesupport (= 3.2.3)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
@@ -144,24 +143,24 @@ GEM
rdoc (3.12)
json (~> 1.4)
remotipart (1.0.2)
- sass (3.1.15)
+ sass (3.1.16)
sass-rails (3.2.5)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
- sprockets (2.1.2)
+ sprockets (2.1.3)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
- sqlite3 (1.3.5)
- subexec (0.2.1)
+ sqlite3 (1.3.6)
+ subexec (0.2.2)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
- tzinfo (0.3.32)
- uglifier (1.2.3)
+ tzinfo (0.3.33)
+ uglifier (1.2.4)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
warden (1.1.1)
View
70 db/schema.rb
@@ -15,35 +15,35 @@
create_table "balls", :force => true do |t|
t.string "color"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
create_table "cms_basic_pages", :force => true do |t|
t.string "title"
t.text "content"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
create_table "comments", :force => true do |t|
t.integer "commentable_id"
t.string "commentable_type"
t.text "content"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
create_table "divisions", :primary_key => "custom_id", :force => true do |t|
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.integer "custom_league_id"
t.string "name", :limit => 50, :null => false
end
create_table "drafts", :force => true do |t|
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.integer "player_id"
t.integer "team_id"
t.date "date"
@@ -55,8 +55,8 @@
end
create_table "fans", :force => true do |t|
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.string "name", :limit => 100, :null => false
end
@@ -76,8 +76,8 @@
t.time "time_field"
t.date "date_field"
t.boolean "boolean_field"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.string "format"
t.string "restricted_field"
t.string "protected_field"
@@ -87,21 +87,21 @@
end
create_table "leagues", :force => true do |t|
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.string "name", :limit => 50, :null => false
end
create_table "nested_field_tests", :force => true do |t|
t.string "title"
t.integer "field_test_id"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
create_table "players", :force => true do |t|
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.datetime "deleted_at"
t.integer "team_id"
t.string "name", :limit => 100, :null => false
@@ -115,47 +115,45 @@
end
create_table "rails_admin_histories", :force => true do |t|
- t.text "message"
+ t.string "message"
t.string "username"
t.integer "item"
t.string "table"
- t.integer "month", :limit => 2
- t.integer "year", :limit => 5
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
- add_index "rails_admin_histories", ["item", "table", "month", "year"], :name => "index_histories_on_item_and_table_and_month_and_year"
+ add_index "rails_admin_histories", ["item", "table"], :name => "index_histories_on_item_and_table"
create_table "rel_tests", :force => true do |t|
t.integer "league_id"
t.integer "division_id", :null => false
t.integer "player_id"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
create_table "teams", :force => true do |t|
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.integer "division_id"
t.string "name", :limit => 50
t.string "logo_url"
- t.string "manager", :limit => 100, :null => false
+ t.string "manager", :limit => 100, :null => false
t.string "ballpark", :limit => 100
t.string "mascot", :limit => 100
t.integer "founded"
t.integer "wins"
t.integer "losses"
t.float "win_percentage"
- t.decimal "revenue"
+ t.decimal "revenue", :precision => 18, :scale => 2
t.string "color"
end
create_table "unscoped_pages", :force => true do |t|
t.string "title"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
create_table "users", :force => true do |t|
@@ -170,8 +168,8 @@
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.string "password_salt"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.string "avatar_file_name"
t.string "avatar_content_type"
t.integer "avatar_file_size"
View
27 db/seeds.rb
@@ -1,18 +1,29 @@
require 'mlb'
-User.create(:email => 'username@example.com', :password => 'password', :password_confirmation => 'password')
+user_model = RailsAdmin::AbstractModel.new(User)
+league_model = RailsAdmin::AbstractModel.new(League)
+division_model = RailsAdmin::AbstractModel.new(Division)
+team_model = RailsAdmin::AbstractModel.new(Team)
+player_model = RailsAdmin::AbstractModel.new(Player)
+
+user_model.new(:email => 'username@example.com', :password => 'password', :password_confirmation => 'password').save
MLB::Team.all.each do |mlb_team|
- unless league = RailsAdmin::AbstractModel.new("League").first(:conditions => ["name = ?", mlb_team.league])
- league = RailsAdmin::AbstractModel.new("League").create(:name => mlb_team.league)
+ unless league = league_model.where(:name => mlb_team.league).first
+ league = league_model.new(:name => mlb_team.league)
+ league.save
end
- unless division = RailsAdmin::AbstractModel.new("Division").first(:conditions => ["name = ?", mlb_team.division])
- division = RailsAdmin::AbstractModel.new("Division").create(:name => mlb_team.division, :league => league)
+ unless division = division_model.where(:name => mlb_team.division).first
+ division = division_model.new(:name => mlb_team.division, :league => league)
+ division.save
end
- unless team = RailsAdmin::AbstractModel.new("Team").first(:conditions => ["name = ?", mlb_team.name])
- team = RailsAdmin::AbstractModel.new("Team").create(:name => mlb_team.name, :logo_url => mlb_team.logo_url, :manager => mlb_team.manager, :ballpark => mlb_team.ballpark, :mascot => mlb_team.mascot, :founded => mlb_team.founded, :wins => mlb_team.wins, :losses => mlb_team.losses, :win_percentage => ("%.3f" % (mlb_team.wins.to_f / (mlb_team.wins + mlb_team.losses))).to_f, :division => division)
+ unless team = team_model.where(:name => mlb_team.name).first
+ team = team_model.new(:name => mlb_team.name, :logo_url => mlb_team.logo_url, :manager => mlb_team.manager, :ballpark => mlb_team.ballpark, :mascot => mlb_team.mascot, :founded => mlb_team.founded, :wins => mlb_team.wins, :losses => mlb_team.losses, :win_percentage => ("%.3f" % (mlb_team.wins.to_f / (mlb_team.wins + mlb_team.losses))).to_f, :division => division)
+ team.save
end
mlb_team.players.reject{|player| player.number.nil?}.each do |player|
- RailsAdmin::AbstractModel.new("Player").create(:name => player.name, :number => player.number, :position => player.position, :team => team)
+ player_model.new(:name => player.name, :number => player.number, :position => player.position, :team => team).save
end
end
+
+puts "Seeded #{league_model.count} leagues, #{division_model.count} divisions, #{team_model.count} teams and #{player_model.count} players"
Please sign in to comment.
Something went wrong with that request. Please try again.