In the EventManager file, in chapter "Moving Displaying Legislators to a Method" it is stated: "We want to extract our legislator names into a new method named legislators_by_zipcode which accepts a single zip code as a parameter and returns a comma-separated string of legislator names."
The code is like this:
def legislators_by_zipcode(zipcode)
legislators = Sunlight::Congress::Legislator.by_zipcode(zipcode)
legislator_names = legislators.collect do |legislator|
"#{legislator.first_name} #{legislator.last_name}"
end
end
#...
legislators = legislators_by_zipcode(zipcode).join(", ")
Which is strictly speaking not the same. Nothing important though, just thought maybe this should be changed to be more precise.
Besides, the variable "legislator_names" is not necessary, is it? I am just starting out with ruby, and write this as I'm working my way through the (great!) tutorial :)
In the EventManager file, in chapter "Moving Displaying Legislators to a Method" it is stated: "We want to extract our legislator names into a new method named legislators_by_zipcode which accepts a single zip code as a parameter and returns a comma-separated string of legislator names."
The code is like this:
Which is strictly speaking not the same. Nothing important though, just thought maybe this should be changed to be more precise.
Besides, the variable "legislator_names" is not necessary, is it? I am just starting out with ruby, and write this as I'm working my way through the (great!) tutorial :)