-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrake routes
More file actions
123 lines (101 loc) · 7.83 KB
/
Copy pathrake routes
File metadata and controls
123 lines (101 loc) · 7.83 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
dantete-HP-425 ayuda_estudiantil_1 # rake routes
new_session GET /sessions/new(.:format) sessions#new
resource_comments POST /resources/:resource_id/comments(.:format) comments#create
resource_comment DELETE /resources/:resource_id/comments/:id(.:format) comments#destroy
resource GET /resources/:id(.:format) resources#show
identity_resources GET /identities/:identity_id/resources(.:format) resources#index
edit_identity_resource GET /identities/:identity_id/resources/:id/edit(.:format) resources#edit
identity_resource PUT /identities/:identity_id/resources/:id(.:format) resources#update
DELETE /identities/:identity_id/resources/:id(.:format) resources#destroy
identities GET /identities(.:format) identities#index
POST /identities(.:format) identities#create
new_identity GET /identities/new(.:format) identities#new
edit_identity GET /identities/:id/edit(.:format) identities#edit
identity GET /identities/:id(.:format) identities#show
PUT /identities/:id(.:format) identities#update
DELETE /identities/:id(.:format) identities#destroy
malla_semestre /plan/malla/:course_outline_id/semestre/:semester(.:format) plan#malla
malla /plan/malla/:course_outline_id(.:format) plan#malla
malla_semestre_curso /plan/malla/:course_outline_id/semestre/:semester/curso/:course_id(.:format) plan#curso
course_resources POST /courses/:course_id/resources(.:format) resources#create
new_course_resource GET /courses/:course_id/resources/new(.:format) resources#new
courses GET /courses(.:format) courses#index
POST /courses(.:format) courses#create
new_course GET /courses/new(.:format) courses#new
edit_course GET /courses/:id/edit(.:format) courses#edit
course GET /courses/:id(.:format) courses#show
PUT /courses/:id(.:format) courses#update
DELETE /courses/:id(.:format) courses#destroy
course_outlines GET /course_outlines(.:format) course_outlines#index
POST /course_outlines(.:format) course_outlines#create
new_course_outline GET /course_outlines/new(.:format) course_outlines#new
edit_course_outline GET /course_outlines/:id/edit(.:format) course_outlines#edit
course_outline GET /course_outlines/:id(.:format) course_outlines#show
PUT /course_outlines/:id(.:format) course_outlines#update
DELETE /course_outlines/:id(.:format) course_outlines#destroy
root / home#index
/auth/:provider/callback(.:format) sessions#create
signout /signout(.:format) sessions#destroy
auth_failure /auth/failure(.:format) sessions#failure
____________________________________________________________________________
DIFRENCIA entre CREATE Y NEW: (es lo mismo que con UPDATE y edit)
CREATE: hay que pasasrle los datos de la entidad a crear. En controller: @post = Post.new(params[:post]).
-Por esta razón es request tipo POST (los datos no pueden de la entidad no deben ir en la URL)
NEW: Es para ingresar los datos de la nueva entidad. En controller: @post = Post.new
- EL tipo de request es GET.
________________________________________________________________________________
MIGRACIONES
para agregar una columna a auna tabla
-rails generate migration add_email_to_users email:string (fijasrse en nombres de las tablas)
se puede editar la migración que se crea (para agregar valores por defecto o propiedaes)
-rake db:migrate
para generar una migracion:
-rails generate migration nombre_migracion
escribirle a la migracion lo que uno quiera
-rails generate paperclip User avatar //paperclip
-rake db:migrate:redo #reahacer la ultima migrate ()
-rake db:migrate:down VERSION=20130707032528 #deshacer la que uno quiera, pero debe tener el metodo def self.down "cambios a devolver" end
1 rails generate controller article
2 # Oops!
3 rails destroy controller article
________________________________________________________
COMMANDS:
-rails generate model Post title:string text:text
-rake tmp:clear,rake log:clear
_________________________________________________________-
GIT:
SUBIR :
git add . //agregar archivo nuevos creados
git commit -m "6Julio"
git commit -a //aceptar lso cambios
git push origin master //ver si pesa mucho hacer: rake tmp:clear,rake log:clear
git pull origin master //bajar actualizaciones y que las mezcle
git clone git@github.com:dantete/ayuda_estudiantil.git //dowlnload proy completo (hacer fuera de l acarpeta del proye)
__________________________________
PAPERCLIP
-migracion:
rails generate paperclip User avatar //paperclip
-en model:
validates_attachment_content_type :file, :content_type => ["application/zip", "application/x-zip", "application/x-zip-compressed", "application/pdf", "application/x-pdf",'application/pdf','text/plain', 'text/xml', 'image/abc', 'some_image/png', 'image/jpeg', 'image/png', 'image/gif'], :message => ': DEBE SER UNA IMAGEN'
has_attached_file :photo, {
:styles => { :large => "700x400#", :medium=>"490x368#", :thumbnail=>"75x75#" },
:default_url => "/images/thumbnail/blank-recipe.png"}
______________________________-
VARIOS:
-<%= link_to 'Add', :controller => :items, :action => :new, :id => @person.id %>
-f.hidden_field :person_id #para pasarle al create cuando hago f.submit
-Client.order("orders_count ASC, created_at DESC")
# OR
Client.order("orders_count ASC", "created_at DESC")
_____________________________
COLUMNAS DEL MODEL
metodos_x: attributes=(attributes),NEW(atributes) y updates(atributes)
attr_accessible :name, :nickname #pueden ser seteados en metodos_x
attr_protected :name #no pueden ser seteados en los metodos_x, PARA PROteger principalmente en el envío de formularios
___________________________________-
ESTRUCTURAS
<% if avatar_identity == nil %>
<i class="icon-user icon-5x"></i>
<% else %>
<%= image_tag avatar_identity.photo.url(:small) %>
<% end %>