Created
April 3, 2017 23:41
-
-
Save jusk02/7e8a290e1f37371bb158d2c745c00052 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
class ProfilesController < ApplicationController | |
# before_action :set_profile, only: [:show, :edit, :update, :destroy] | |
def show | |
@profile = Profile.find(current_user.userId,current_user.id) | |
signos = Concepto.find_all(current_user.id) | |
observaciones = Observacion.find(current_user.userId,current_user.id) | |
@signos = ConceptoPresenter.new(signos, observaciones) | |
@signos.todos | |
# return render :edit unless @profile.nombres.primerNombre | |
end | |
def edit | |
@profile ||= Profile.find(current_user.userId,current_user.id) | |
end | |
def update | |
@profile= Profile.find(current_user.userId,current_user.id) | |
@profile.update(profiles_params, current_user.id) | |
redirect_to @profile, notice: "Actualización exitosa" | |
end | |
def calendar | |
end | |
def apps | |
end | |
def observaciones | |
p params | |
end | |
private | |
def profiles_params | |
params.require(:profile).permit(:id,:avatar,:usuarioId, | |
nombres_attributes: [:primerNombre,:segundoNombre, :primerApellido, :segundoApellido, :perfilId], | |
estadosCiviles_attributes: [:estadoCivil,:perfilId], | |
datosGenerales_attributes: [:genero, :grupoSanguineo, :raza,:perfilId ], | |
datosNacimiento_attributes: [:fechaNacimiento, :pais, :departamento, :municipio, :perfilId], | |
nacionalidades_attributes: [:nacionalidad, :perfilId], | |
direcciones_attributes: [:direccion, :direccionAlternativa, :ubicacion, :latitud, :longitud, :perfilId], | |
identificaciones_attributes: [:numeroIdentificacion, :tipoIdentificacion, :lugarExpedicion, :perfilId], | |
entidadesPrestadorasSalud_attributes: [:eps, :centroSalud, :lugarAtencion, :codigoPrestadorServicio, :planComplementarioSalud, :perfilId] | |
) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment