Even with the LevelSourceHint.delete_all above?


On Wed, Jun 4, 2014 at 11:01 AM, nanan9177 <notifications@github.com> wrote:

> In lib/tasks/seed.rake:
>
> > @@ -14,6 +14,21 @@ namespace :seed do
> >      end
> >    end
> >
> > +  task import_stanford_hints: :environment do
> > +    LevelSourceHint.transaction do
> > +      LevelSourceHint.delete_all("hint_id is not null")
> > +      CSV.read('config/stanford-hint-ids.tsv', { col_sep: "\t" }).each do |row|
> > +        LevelSourceHint.create!(level_source_id: row[0], hint_id: row[1])
>
> This may create a duplicate, maybe use find_or_create instead.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/code-dot-org/dashboard/pull/771/files#r13400892>.
>