Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository has been archived by the owner. It is now read-only.

Commit a542d36

Browse files
committed
aactiones para parentesco
1 parent 46ba815 commit a542d36

File tree

10 files changed

+56
-0
lines changed

10 files changed

+56
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
class KinshipsController < ApplicationController
2+
def index
3+
@kinships = Kinship.all
4+
end
5+
6+
def new
7+
@kinship = Kinship.new
8+
end
9+
10+
def create
11+
@kinship = Kinship.create(params[:kinship])
12+
redirect_to kinships_path
13+
end
14+
15+
def edit
16+
end
17+
18+
def update
19+
end
20+
end

app/helpers/kindship_helper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
module KindshipHelper
2+
end

app/models/kinship.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
class Kinship < ActiveRecord::Base
22
attr_accessible :kinship
33
has_many :representative_student
4+
5+
6+
def to_s
7+
kinship
8+
end
49
end
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
div
2+
= button_to("Editar", edit_kinship_path(kinship),:method => :get)

app/views/kinships/_form.slim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
= semantic_form_for @kinship do |f|
2+
= f.input :kinship , label: "Nombre del parentesco"
3+
= f.action :submit, label: "#{@kinship.id.nil? ? "Crear" : "Actualizar"} parentesco"

app/views/kinships/create.slim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<h1>Kindship#create</h1>
2+
<p>Find me in app/views/kindship/create.html.erb</p>

app/views/kinships/edit.slim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<h1>Kindship#edit</h1>
2+
<p>Find me in app/views/kindship/edit.html.erb</p>

app/views/kinships/index.slim

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
h1 Tabla de parentesco
2+
table
3+
- @kinships.each do |kinship|
4+
tr
5+
td
6+
=link_to(kinship, kinship_path(kinship))
7+
td
8+
= render :partial => "action_items", locals: {kinship: kinship}
9+
10+
- if @kinships.length == 0
11+
tr
12+
td No tenemos parentescos registrados
13+
14+
tr
15+
td = link_to('Nuevo parentesco',new_kinship_path)

app/views/kinships/new.slim

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
h1 Nuevo parentesco
2+
p Formulario para la creacion de nuevo parentesco
3+
= render :partial => "form"

app/views/kinships/update.slim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<h1>Kindship#update</h1>
2+
<p>Find me in app/views/kindship/update.html.erb</p>

0 commit comments

Comments
 (0)