Table City Model
class TableCity < ActiveRecord::Base
has_many :near_cities, :foreign_key => "nearcity_id"
end
NearCity Model
class NearCity < ActiveRecord::Base
belongs_to :table_city
end
Controller
@table_cities = TableCity.find(:all, :conditions=>{:state => params[:gm], :language => params[:sp]}, :include => :near_cities)
View
<% @table_cities.each do |table_city| %>
<%= table_city.name %>
<% table_city.near_cities.each do |city| %>
<%= city.text %>
<% end %>
<% end %>
This is not working, Kindly give me some suggestions.