-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
100 lines (70 loc) · 3.52 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
################
# English #
################
First of a series of projects that will serve as examples of simple Rails functionalities to new comers.
Goals:
Add comments to several models.
Allow reply.
Nesting comments.
Add some ajax.
Requirements:
Jquery (a javascript library that makes javascript related functions easy)
Rails 3.0 and up (previous versions will look different mainly in the routes section)
awesome_nested_set (a gem /plugin that makes dealing with nestind easy)
Note: at the moment awesome nested set has to be hacked to work with rails 3.0 so in this project is installed
as a plugin, and the following lines were edited:
#89 changed: name_scope to scope and commented the :order options
#90 changed: name_scope to scope and commented the :order options
#567 removed: ", nested_set_scope.proxy_options[:conditions]"
Setup:
First , bundle install then migrate your database with rake db:migrate , then add some dummy data with rake db:seed.
Pendding:
Commeting the code, and ajaxing the comments.
Observations:
Never allow users to post comment without first verifying is they are humans.
you can use recaptcha, and/or a publishing page in the admin seccion.
Read sequence:
This is how you should read the comments to understand what is happening
1- Article model, app/models/article.rb
2- Comment model, app/models/comment.rb
3- routes file, config/routes.rb
4- comments controller, app/controllers/comments_controller.rb
5- articles controller, app/controllers/articles_controller.rb
6- articles show template, app/views/show.html.erb
/******************Please**************************/
If there is a translation issue or if something is not clear notify
################
# Español #
################
El primero de una serie de proyectos, en los que se muestra como hacer tareas
comunes, para los que estan aprendiendo Ruby on Rails.
Objetivos:
Poder agreagar comentarios a mas de un modelo.
Poder responder a los comentario.
Anidar las respuestas.
Agregar ajax(actualizar una parte de la pagina no completa).
Requisitos:
Jquery (una libreria de javascript the facilita mucho realizar tareas de javascript)
Rails 3.0 and up ( las versiones anteriores son un poco diferentes en la seccion de rutas)
awesome_nested_set (una gema/plugin que facilita trabajar con recursos anidados)
Nota: la gems awesome nested set cuando se hizo este ejemplo no estaba lista para
rails 3 asi que hubo que alterar las siguientes lineas:
#89 cambie: name_scope a scope y comente la opcion :order
#90 cambie: name_scope a scope y comente la opcion :order
#567 quite: ", nested_set_scope.proxy_options[:conditions]"
Setup:
Primero , ejecuta bundle install luego migra tu base de datos con rake db:migrate,
depues llenala de datos de prueba rake db:seed.
Pendiente:
No he comentado el codigo aún, ni he puesto ajax.
Observaciones:
Nunca publiques el comentario directamente, se debe verificar primero que el vititante es un humano.
Lo normal es usar recaptcha, y/o una pagina de publiación en la sección de administración.
Secuencia de lecura:
Lee en esta secuencia para entender mejor
1- modelo Article , app/models/article.rb
2- modelo Comment , app/models/comment.rb
3- archivo de rutas, config/routes.rb
4- controllador de comentarios, app/controllers/comments_controller.rb
5- controllador de articles, app/controllers/articles_controller.rb
6- plantilla show the articles, app/views/show.html.erb