Ruby no route matches -



Ruby no route matches -

please tell me why have error

no route matches {:action=>"show51", :controller=>"patients"}

and after search in select51 don't list of patients in index51, hope included files need help me this

routes:

zoz::application.routes.draw resources :refferals #17 potwierdzanie rejestracji resources :appointments collection 'search' 'search_result' 'to_confirm' end fellow member set :confirm end end resources :clinics resources :doctors resources :patients collection 'select51' 'index51' end fellow member 'show51' end end "welcome/index2" "welcome/index" 'appointments/create' 'appointments/move' => 'appointments#move' post 'appointments/move' => 'appointments#doctors_list' 'appointments/move/:id' => 'appointments#doctor_appointments', as: :doctor_appointments 'appointments/change_appointment/:id' => 'appointments#change_appointment', as: :change_appointment 'appointments/change_doctor_and_appointment/:id' => 'appointments#change_doctor_and_appointment', as: :change_doctor_and_appointment 'appointments/success' => 'appointments#success' # priority based upon order of creation: # first created -> highest priority. # sample of regular route: # match 'products/:id' => 'catalog#view' # maintain in mind can assign values other :controller , :action # sample of named route: # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase # route can invoked purchase_url(:id => product.id) # sample resource route (maps http verbs controller actions automatically): # sample resource route options: # resources :products # fellow member # 'short' # post 'toggle' # end # # collection # 'sold' # end # end # sample resource route sub-resources: # resources :products # resources :comments, :sales # resource :seller # end # sample resource route more complex sub-resources # resources :products # resources :comments # resources :sales # 'recent', :on => :collection # end # end # sample resource route within namespace: # namespace :admin # # directs /admin/products/* admin::productscontroller # # (app/controllers/admin/products_controller.rb) # resources :products # end # can have root of site routed "root" # remember delete public/index.html. root :to => 'welcome#index' # see how routes lay out "rake routes" # legacy wild controller route that's not recommended restful applications. # note: route create actions in every controller accessible via requests. # match ':controller(/:action(/:id))(.:format)' end

patients/index51:

<!-- ####################################################################################################### --> <div id="container"> <center> <h1>wyniki wyszukiwania:</h1> <p> lista pacjentów spełniających podane kryteria w porządku alfabetycznym </br> wybierz odpowiedniego pacjenta aby przejść kolejnego etapu! </p> <table border="1"> <thead> <tr> <th>imie</th> <th>nazwisko </th> <th>adres</th> <th>pesel</th> <th>telefon</th> <th colspan="3"></th> </tr> </thead> <tbody> <% @patients.each |patient| %> <tr> <td><%= patient.imie %></td> <td><%= patient.nazwisko %></td> <td><%= patient.adres %></td> <td><%= patient.pesel %></td> <td><%= patient.telefon %></td> <td><%= link_to 'wybierz pacjenta', show51_patient_path %></td> </tr> <% end %> </tbody> </table> </br> <%= link_to 'powrót wyszukiwarki', select51_patients_path %> </center> </div>

patients/show51:

<!-- ####################################################################################################### --> <div id="container"> <center> <h3>dane wybranego pacjenta:</h3> <p> <strong>imie:</strong> <%= @patient.imie %> </p> <p> <strong>nazwisko:</strong> <%= @patient.nazwisko %> </p> <p> <strong>adres pacjenta:</strong> <%= @patient.adres %> </p> <p> <strong>pesel pacjenta:</strong> <%= @patient.pesel %> </p> <p> <strong>numer telefonu:</strong> <%= @patient.telefon %> </p> <h3>wybierz typ rejestracji aby przejść dalej:</h3> <h4> <%= link_to 'rejestracja na wizytę', doctors_path %> </br> <%= link_to 'rejestracja na badanie', clinics_path %> </h4> </br> <%= link_to 'powrót wyszukiwarki', select51_patient_path %> </center> </div>

patients/select51:

<!-- ####################################################################################################### --> <div id="container"> <center> <h1>witaj!</h1> <p> tutaj możesz zarejestrować pacjenta na: </br> 1. wizytę wybranego lekarza </br> 2. konkretny typ badania <h4>wyszukaj pacjenta po numerze pesel:</h4> <%= form_tag(index51_patients_path, :method => "get", id: "search-form") %> <%= text_field_tag :search, params[:search], placeholder: "tutaj wpisz dane" %> <%= submit_tag "przeszukaj bazę", :name => nil %> <% end %> <h5> uwaga! możesz wyszukać również po nazwisku pacjenta! </br> wystarczy wpisać je w powyższe pole zamiast numeru pesel </br> aby wyświetlić wszystkich pacjentów pozostaw pole puste! </h5> </p> </center> </div>

controller:

class patientscontroller < applicationcontroller # /patients # /patients.json def index51 @patients = patient.all if params[:search] @patients = patient.search(params[:search]).order("created_at asc") else @patients = patient.all.order('created_at asc') end end # /patients/select51 def select51 @patients = patient.all respond_to |format| format.html # select51.html.erb format.json { render json: @patients } end end # /patients/1 # /patients/1.json def show51 @patient = patient.find(params[:id]) session[:current_patient_id] = @patient.id respond_to |format| format.html # show51.html.erb format.json { render json: @patient } end end # /patients/new # /patients/new.json def new @patient = patient.new respond_to |format| format.html # new.html.erb format.json { render json: @patient } end end # /patients/1/edit def edit @patient = patient.find(params[:id]) end # post /patients # post /patients.json def create @patient = patient.new(params[:patient]) respond_to |format| if @patient.save format.html { redirect_to @patient, notice: 'patient created.' } format.json { render json: @patient, status: :created, location: @patient } else format.html { render action: "new" } format.json { render json: @patient.errors, status: :unprocessable_entity } end end end # set /patients/1 # set /patients/1.json def update @patient = patient.find(params[:id]) respond_to |format| if @patient.update_attributes(params[:patient]) format.html { redirect_to @patient, notice: 'patient updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @patient.errors, status: :unprocessable_entity } end end end # delete /patients/1 # delete /patients/1.json def destroy @patient = patient.find(params[:id]) @patient.destroy respond_to |format| format.html { redirect_to patients_url } format.json { head :no_content } end end end

error:

nameerror in patients#index51 showing d:/p15/app/views/patients/index51.html.erb line #30 raised: undefined local variable or method `show51_patients_path' #<#<class:0x70fbe10>:0x43b64e0> extracted source (around line #30): 27: <td><%= patient.adres %></td> 28: <td><%= patient.pesel %></td> 29: <td><%= patient.telefon %></td> 30: <td><%= link_to 'wybierz pacjenta', show51_patients_path %></td> 31: </tr> 32: <% end %> 33: </tbody>

<td><%= link_to 'wybierz pacjenta', show51_patient_path %></td>

should be

<td><%= link_to 'wybierz pacjenta', show51_patient_path(patient) %></td>

ruby-on-rails ruby routes

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -