I'm new to rails and need some help with iterating through a sql result.
I have a method in my model that uses find_by:
def self.find_country()
@countries = CountryTable.find_all_by_country_status('Y', :select => "country_name")
@countries.each do |c|
puts "#{c.inspect}"
end
end
This is what I have in the view:
<%= select_tag "country", options_for_select(CountryTable.find_country) %>
Then I get this awkward #<CountryTable:0x30509bc> instead of the country name shown for each select option in the source:
<option value="#<CountryTable:0x30509bc>">#<CountryTable:0x30509bc></option>
<option value="#<CountryTable:0x3050944>">#<CountryTable:0x3050944></option>
<option value="#<CountryTable:0x30508e0>">#<CountryTable:0x30508e0></option>
I'm so new to rails that I'm probably not even go about this right.