Guest User

Untitled

a guest
Feb 21st, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. ----------------MODELO---------------------
  2.  
  3. class Paciente < ActiveRecord::Base
  4. belongs_to :usuario
  5. has_many :resultados
  6. end
  7.  
  8. ----------------CONTROLADOR --------------------
  9.  
  10. class PacienteController < ApplicationController
  11. def index
  12. end
  13.  
  14. def crear
  15. @paciente = Paciente.new(params[:paciente])
  16. if @paciente.save
  17. flash[:notice] = 'guardado jijiij'
  18. end
  19. end
  20.  
  21. def mostrar
  22. @paciente = Paciente.find(:all)
  23. end
  24.  
  25. def editar
  26. end
  27.  
  28. def borrar
  29. end
  30.  
  31. end
  32.  
  33. ------------- VISTA crear----------------------------
  34.  
  35. <h1>Crear pacientes</h1>
  36. <% form_for :paciente do |p| %>
  37. <p>nombre<br />
  38. <%= p.text_field :nombre %>
  39. </p>
  40. <p>
  41. edad <br />
  42. <%= p.text_field :edad %>
  43. </p>
  44. <p>
  45. correo <br />
  46. <%= p.text_field :correo %>
  47. </p>
  48. <p>
  49. <%= p.submit "crear" %>
  50. </p>
  51. <% end %>
Add Comment
Please, Sign In to add comment