Displaying 2 results from an estimated 2 matches for "teacher_control".
2010 Jun 18
0
Simple search in ror
...r => "teachers", :action => "search"}, :method =>
"get") do %>
<%= text_field_tag :query, nil, :id => "search-text" %>
<%= submit_tag("GO", :id => "search-submit") %>
<% end %>
2- the search method in teacher_controller.rb
def search
session[:query] = params[:query].strip if params[:query]
if session[:query]
@teachers = Teacher.find(:all, :conditions => ["materie LIKE ?",
"%#{session[:query]}%"], :order => "cognome ASC")
end
end
3- the page for the resu...
2010 Nov 04
9
Delete action is not working and redirects to edit action
...t;"20x20",:border=>"0"), teacher, :confirm =>
''Are you sure?'', :method => :delete)%>
also tried but i get the same action
<%= link_to ''Delete'', teacher, :confirm=>"Are you
sure?", :method=>:delete %>
The teacher_controller action is:
# DELETE /teachers/1
# DELETE /teachers/1.xml
def destroy
@teacher = Teacher.find(params[:id])
@teacher.destroy
respond_to do |format|
format.html { redirect_to(teachers_url) }
format.xml { head :ok }
end
end
In the routes i only use resources :te...