Created
November 27, 2008 05:29
-
-
Save anonymous/29690 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
----------------MODELO--------------------- | |
class Paciente < ActiveRecord::Base | |
belongs_to :usuario | |
has_many :resultados | |
end | |
----------------CONTROLADOR -------------------- | |
class PacienteController < ApplicationController | |
def index | |
end | |
def crear | |
@paciente = Paciente.new(params[:paciente]) | |
if @paciente.save | |
flash[:notice] = 'guardado jijiij' | |
end | |
end | |
def mostrar | |
@paciente = Paciente.find(:all) | |
end | |
def editar | |
end | |
def borrar | |
end | |
end | |
------------- VISTA crear---------------------------- | |
<h1>Crear pacientes</h1> | |
<% form_for :paciente do |p| %> | |
<p>nombre<br /> | |
<%= p.text_field :nombre %> | |
</p> | |
<p> | |
edad <br /> | |
<%= p.text_field :edad %> | |
</p> | |
<p> | |
correo <br /> | |
<%= p.text_field :correo %> | |
</p> | |
<p> | |
<%= p.submit "crear" %> | |
</p> | |
<% end %> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment