After a little search i found the solution for the above issue.
Obviously observe_field method has been deprecated in rails 3.
So in order to solve this issue, we need to just remove the observe_field helper method and add a javascript code inside javascript_tag of the view template as follows:
<% javascript_tag :defer => "defer" do %>
function project_changed()
{
object = window.document.getElementById("project_selector");
if (object)
{
if (object.selectedIndex != -1)
{
project_id = object.options[object.selectedIndex].id;
<% @projects.each do |project| %>
project_div = window.document.getElementById("project_<%= project.id %>_versions");
if (project_div)
{
project_div.style.display = "none";
project_div.style.visibility = "hidden";
}
<% end %>
project_div = window.document.getElementById("project_" + project_id + "_versions");
if (project_div)
{
project_div.style.display = "";
project_div.style.visibility = "";
}
}
}
}
jQuery(function($)
{
$(\"#project_selector\").change(project_change);
})
<% end %>
what exactly is done is just we removed helper method and added a small jquery code.
jQuery(function($)
{
$(\"#project_selector\").change(project_change);
})