Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jl services update script #76

Merged
merged 8 commits into from Feb 15, 2017
Merged

Jl services update script #76

merged 8 commits into from Feb 15, 2017

Conversation

jleonardw9
Copy link

No description provided.

ActiveRecord::Base.transaction do
CSV.foreach(input_file, :headers => true) do |row|
service = Service.find(row['service_id'].to_i)
service = Service.where(id: row['Service ID'].to_i).first

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's wrong with #find here?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, then you could leave off the #first

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is with the import file. There are a bunch of null values after the last service row. The 'where' handles this.

@jleonardw9 jleonardw9 merged commit fbd6784 into master Feb 15, 2017
@jleonardw9 jleonardw9 deleted the jl-services-update-script branch February 15, 2017 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants