I am having trouble with a rails project. The server prints out the following message when I press the refresh button:
Started GET "/assets?action=select_refresh&controller=home&id=1" for 127.0.0.1 at Thu Jun 07 22:54:19 -0700 2012
ActionController::RoutingError (No route matches [GET] "/assets"): config/initializers/quiet_assets.rb:7:in `call'
Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.2.5/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/la yout (1.2ms)
Here is my code:
hom_controller.rb
class HomeController < ApplicationController
def index
end
def select_refresh
print("debug")
@specs = Specialization.find(params[:id])
if @specs.update_attributes(params[:specialization])
printnamessid = "printnames" + @specs.id.to_s
render :update do |page|
page[printnamessid].replace :partial => "printnames", :locals => {:s => @specs}
end
else
print("do nothing")
end
end
end
spec.html.erb
<h1>Specializations</h1>
<div id="somediv">
<table width="600" border="2" cellpadding="2" cellspacing="2" align="center">
<tr>
<td width="280">Specialization Name</td>
<td width="50">Application count</td>
<td width="100">Applicant Names</td> <!--table in here-->
<td width="70">Refresh</td>
</tr>
<% Specialization.all.each do |s| %>
<tr>
<td><%= s.name %></td>
<td><%= render :partial => "printcount", :locals => {:s => s} %></td>
<td><%= render :partial => "printnames", :locals => {:s => s} %></td>
<td><%= link_to "Refresh", {:action => "select_refresh", :id => s }, :remote => true %></td>
</tr>
<% end %>
_printnames.html.erb
<div id="printnames<%= s.id%>">
<table width="100" border="2" cellpadding="2" cellspacing="2" align="center">
<% s.applicant.each do |a| %>
<tr>
<td><%= a.firstname %></td>
</tr>
<% end %>
</table>
</div>
Do you have any idea whats wrong? I've googled it a bit, but all i find is problems with previous versions of rails? I am using version 3.2.5.
And do you know an easy way to put printlines in the terminal or printing alerts (like js) from the function?