Incomplete Seeding

Fixed the seeding bugs with much help from Michael.
Done.

On Fri, Oct 3, 2014 at 2:37 PM, Michael Alexander <notifications@github.com>
wrote:

> In db/seeds.rb:
>
> > +    end
> > +  end
> > +  [cities, towns, villages]
> > +end
> > +
> > +SAMPLECITIES = sample_cities
> > +
> > +def random_user_addresses(user_id)
> > +  address_choices = (Address.select(:id).where(:user_id => user_id)).to_a
> > +  address_choices[0] ? [address_choices.sample[:id], address_choices.sample[:id]] : [nil, nil]
> > +end
> > +
> > +def generate_addresses(user_id)
> > +  (rand(6)).times do
> > +    city_instance = SAMPLECITIES.sample.sample
> > +    a = Address.new({user_id: user_id, street_address: Faker::Address.street_address, city: city_instance["city"], state: city_instance["state"], zip: Faker::Address.zip_code.to_i})
>
> maybe some line breaks? Either by setting attributes independently, or
> just by splitting up the long line with continuations
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/vikingeducation/viking_store/pull/2/files#r18420975>.
>