Skip to content

Instantly share code, notes, and snippets.

No route matches {:action=>"show", :controller=>"evaluares", :pacient_id=>#<Evaluare id: 88, data: "2009-10-30", diagnostice: "IRC std III, dz tip 2 complicat, BCI angor de efort...", recomandari: "1.dieta cu 250hc, hiposodat cu restrictie proteica:...", pacient_id: 828, created_at: "2012-09-12 17:40:09", updated_at: "2012-09-12 17:40:09">}
controller that fetches pacient
class EvaluaresController < ApplicationController
def index
@pacient = Pacient.find(params[:pacient_id])
@evaluares = @pacient.evaluares
respond_to do |format|
format.html # index.html.erb
end
end
link from evaluares#new
<%= link_to 'Add a paraclinic that is not on the list', new_pacient_evaluare_paraclinic_path(@pacient, @evaluare)%>
fails with
No route matches {:action=>"new", :controller=>"paraclinics", :pacient_id=>#<Pacient id: 828, nume: "Popescu", prenume: "Gheorghe", cnp: "1220702400141", adresa: nil, debut_diabet: "1977-01-01", focad: nil, created_at: "2012-09-03 19:54:04", updated_at: "2012-09-03 19:54:04">, :evaluare_id=>#<Evaluare id: nil, data: nil, diagnostice: nil, recomandari: nil, pacient_id: nil, created_at: nil, updated_at: nil>}
namespace :db do
task :seed => :environiment do
task :medici do
desc "Adaug medici in baza de date"
Medic.create!(:nume => "Serafinceanu", :prenume => "Cristian", :cod_parafa => "282828")
Medic.create!(:nume => "Craciun", :prenume =>"Anne-Marie", :cod_parafa =>"999")
end
end
end
create_table "drugs", :force => true do |t|
t.string "nume"
t.string "dci"
t.float "doza"
t.string "cod"
t.string "diagnostic"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
<%= link_to "Adauga retetar", new_retetar_path, :data=>{:toggle=>"modal", :target => "#newRetetarModal"}, :remote => true %>
<div id="newRetetarModal" class="modal hide fade">
<button type="button" class="close" data-dismiss="modal">x</button>
<div class="page-header">
<h2> Retetar nou</h2>
</div>
<% @retetar = Retetar.new %>
<%= render :partial => '/retetars/form' %>
</div>
controller:
form:
<div id="newRetetarModal" class="modal hide fade">
<button type="button" class="close" data-dismiss="modal">x</button>
<div class="page-header">
<h2> Retetar nou</h2>
</div>
<% @retetar = Retetar.new %>
<input id="nimic" type="hidden" value="<%= params[:modal] = true%>" />
<%= render :partial => '/retetars/form' %>
</div>
link and modal:
<%= link_to 'Adauga pacient in evidenta', new_pacient_path, :class=>"btn btn-mini btn-info",
:data =>{:toggle => "modal", :target=>"#newPacientModal"}, :remote => true %> <br/>
<div id="newPacientModal" class="modal hide fade">
<button type="button" class="close" data-dismiss="modal">&times</button>
<div class="modal-header">
<h3> Adauga pacient nou</h3>
<div class="modal-body">
<%= render :partial =>'form-modal' %>
link and modal:
<%= link_to 'Adauga pacient in evidenta', new_pacient_path, :class=>"btn btn-mini btn-info",
:data =>{:toggle => "modal", :target=>"#newPacientModal"}, :remote => true %> <br/>
<div id="newPacientModal" class="modal hide fade">
<button type="button" class="close" data-dismiss="modal">&times</button>
<div class="modal-header">
<h3> Adauga pacient nou</h3>
</div>
<%= render :partial =>'form-modal' %>
$("form.new_pacient").on "ajax:success", (event, data, status, xhr) ->
$("#newPacientModal").modal('hide')