Sha256: 3d96aa146a72f2da1be99ada970db0d45b39f29c85826db6aaf852bd857ea5c2

Contents?: true

Size: 1.78 KB

Versions: 1

Compression:

Stored size: 1.78 KB

Contents

class ActiveRecordController < ApplicationController
  before_filter :populate_database

  def index
  end

  protected
  def ar_view
    @ar_view ||= ActiveRecordView.new(params)
  end
  helper_method :ar_view

  private
  def populate_database
    if Person.count == 0
      [["Delcie", "Pounds"],
      ["Charles", "Burtch"],
      ["Hayden", "Paterno"],
      ["Nery", "Vanwingerden"],
      ["Janey", "Leachman"],
      ["Sharda", "Rierson"],
      ["Inga", "Wilt"],
      ["Gertie", "Bannister"],
      ["Gladys", "Callery"],
      ["Roxanne", "Jeong"],
      ["Tamiko", "Cumberbatch"],
      ["Glady", "Haakenson"],
      ["Roxana", "Persons"],
      ["Zofia", "Linebaugh"],
      ["Susannah", "Laduke"],
      ["Huong", "Bass"],
      ["Kelsi", "Conine"],
      ["Petronila", "Epping"],
      ["Nakesha", "Crace"],
      ["Johnette", "Holsinger"],
      ["Richie", "Fairchild"],
      ["Page", "Abdul"],
      ["Elyse", "Romaine"],
      ["Zandra", "Vitela"],
      ["Shantelle", "Vandam"],
      ["Boris", "Sales"],
      ["Buck", "Yadon"],
      ["Shizue", "Henery"],
      ["Eleni", "Mckay"],
      ["Anjelica", "Setzer"],
      ["Rosamaria", "Snead"],
      ["Millie", "Predmore"],
      ["Erline", "Masden"],
      ["Fran", "Laughridge"],
      ["Tish", "Herrmann"],
      ["Pok", "Fitzmaurice"],
      ["Colette", "Benner"],
      ["Libby", "Hyman"],
      ["Hellen", "Choi"],
      ["Tyson", "Howard"],
      ["Beatriz", "Loy"],
      ["Cristine", "Dexter"],
      ["Yetta", "Freitag"],
      ["Lilliam", "Mcgowin"],
      ["Leonel", "Simpler"],
      ["Alleen", "Mulford"],
      ["Giuseppe", "Secord"],
      ["Risa", "Patel"],
      ["Ryann", "Pool"],
      ["Geneva", "Sipe"]].each do |(firstname, lastname)|
        Person.create(firstname: firstname, lastname: lastname)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flexirails-0.1.0 test/dummy/app/controllers/active_record_controller.rb