I've got an array of strings that looks like this:
[noindex,nofollow]
or ["index", "follow", "all"]
I'm calling these "tags_array." I've got a method that looks like this:
return true if self.tags_array.to_s.include? "index" and !self.tags_array.to_s.include? "noindex"
But I think there's a smarter way to run this code than to take the entire array and convert it to an string.
The problem is, sometimes the info comes in as a single element array and other times it comes in as an array of strings.
Any suggestions on the smartest way to do this?
include?in a conditional statement with anandororthen you'll want to put the argument ofinclude?in parentheses like.include?("index")or else you could throw off the condition.