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

Fix NoMethodError on untagged post #93

Merged
merged 1 commit into from
Nov 23, 2013

Conversation

nicuveo
Copy link

@nicuveo nicuveo commented Nov 21, 2013

Untagged posts have a nil tags value ({:tags => nil}), which results in a NoMethodError.

@@ -87,7 +87,7 @@ def self.process(options)
node_id = post[:nid]
title = post[:title]
content = post[:body]
tags = post.fetch(:tags, '').downcase.strip
tags = (post.fetch(:tags, nil) or '').downcase.strip
Copy link
Member

Choose a reason for hiding this comment

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

Why don't we just go with post[:tags] || "" instead?

@nicuveo
Copy link
Author

nicuveo commented Nov 22, 2013

@parkr in case there's no :tags key in the post, which was the reason for fetch in the first place (or so I'd guessed). However, writing this, I realize there will always be a :tags key, because this is a db row... I'll fix that right now.
Oh, also, I only fully read the ruby guidelines after submitting, hence the misuse of or. Sorry for that.

Untagged posts have a nil tags value (`{:tags => nil}`), which results in a NoMethodError.
@parkr
Copy link
Member

parkr commented Nov 22, 2013

No problem! This LGTM.

parkr added a commit that referenced this pull request Nov 23, 2013
Drupal6: Fix NoMethodError on untagged post
@parkr parkr merged commit adc1351 into jekyll:fix-drupal-importers Nov 23, 2013
parkr added a commit that referenced this pull request Nov 23, 2013
@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants