hobo 2.0.0.pre6 → 2.0.0.pre7

Sign up to get free protection for your applications and to get access to all the features.
@@ -405,6 +405,12 @@ push-state works best in an HTML5 browser. It works in older browsers
405
405
  such as IE8, IE9 or Firefox 3, but results in strange looking URL's. See
406
406
  the README for History.js for more details on that behaviour.
407
407
 
408
+ ### turbolinks support
409
+
410
+ [turbolinks](https://github.com/rails/turbolinks) provides capabilities similar to the push-state fragment Ajax described above. However, rather than updating fragments, it updates the entire page. This makes it slightly slower but does not require any code modification.
411
+
412
+ Turbolinks is not compatible with the [bottom-load-javascript](http://cookbook-1.4.hobocentral.net/manual/changes20#bottomloading_javascript) option.
413
+
408
414
  ### plugin generators
409
415
  {.part}
410
416
 
@@ -496,6 +502,8 @@ Turning on bottom-load will prevent Rails from splitting front.js into
496
502
  multiple files even if you enable config.assets.debug in your
497
503
  environment.
498
504
 
505
+ bottom-load-javascript is incompatible with turbolinks.
506
+
499
507
  ### allowing errors in parts
500
508
  {.todo}
501
509
 
@@ -506,9 +514,10 @@ This behaviour may now be overridden by using the 'errors-ok'
506
514
  attribute on your form. (or formlet or whatever other tag initiates
507
515
  the Ajax call).
508
516
 
509
- The 'errors-ok' attribute is processed in update_response. If you've
510
- supplied a block to hobo_update you will be responsible for
511
- implementing this functionality yourself.
517
+ The 'errors-ok' attribute is processed in update_response. If you
518
+ render or redirect inside a block to hobo_update you will be
519
+ responsible for implementing this functionality yourself, or calling
520
+ update_response to do it for you.
512
521
 
513
522
  ### AJAX file uploads
514
523
  {.todo}
@@ -768,23 +777,13 @@ field is named "project.title", parse_sort_param will sort on the
768
777
  column "projects.title".
769
778
 
770
779
  ### controller actions
771
- {.todo}
780
+ {.done}
772
781
 
773
782
  Hobo no longer attempts to perform its part-based AJAX actions when
774
783
  sent an xhr request. Instead, Hobo performs part-based AJAX when
775
784
  params[:render] is set.
776
785
 
777
- The signature for the function update_response and friends has changed. This should make it useful for use in your application. It can be used like this:
778
-
779
- def update
780
- hobo_update do
781
- if params[:foo]==17
782
- render_my_way
783
- else
784
- update_response # let Hobo handle it all
785
- end
786
- end
787
- end
786
+ The signature for the function update_response, index_response and friends have changed. This should make it useful for use in your application. update_response is called automatically by hobo_update if you don't render or redirect inside of the block parameter hobo_update.
788
787
 
789
788
  ### default controller actions now use respond_with
790
789
 
@@ -798,6 +797,24 @@ Note that the JSON and XML interfaces will only use coarse grained
798
797
  model-level permission checking rather than fine grained attribute
799
798
  level permission checking.
800
799
 
800
+ ### custom alternate formats
801
+
802
+ Hobo no longer executes an arity zero block passed to hobo controller actions inside of a respond_to block. This means that you can render formats other than html inside of an arity zero block.
803
+
804
+ hobo_show do
805
+ render something if request.format.pdf?
806
+ end
807
+
808
+ Any formats that you do not render or redirect inside the block will be handled by hobo_show via respond_with.
809
+
810
+ If your block has a parameter, the block continues to be executed inside of a respond_to.
811
+
812
+ hobo_show do |format|
813
+ format.pdf do { render something }
814
+ end
815
+
816
+ Because this is a respond_to block any formats you do not render will fall through and be handled by hobo_show's respond_with block.
817
+
801
818
  ### before-unload
802
819
  {.check}
803
820
 
@@ -849,7 +866,7 @@ the change is one I could do myself...)
849
866
  - https://github.com/tablatom/hobo/commit/e9460d336ef85388af859e5082763bfae0ad01f5
850
867
 
851
868
  ### controller changes
852
- {.todo}
869
+ {.done}
853
870
 
854
871
  Due to limitations on Ajax file uploads, multipart forms are not sent with the proper Ajax headers. If your controller action may receive multipart forms, rather than using:
855
872
 
@@ -869,7 +886,7 @@ use
869
886
  for more information see http://jquery.malsup.com/form/#file-upload
870
887
 
871
888
  ### hobo_ajax_response
872
- {.todo}
889
+ {.done}
873
890
 
874
891
  the `hobo_ajax_response` function now has a different signature.
875
892
  Standard usage doesn't supply any arguments to hobo_ajax_response.
@@ -405,6 +405,12 @@ push-state works best in an HTML5 browser. It works in older browsers
405
405
  such as IE8, IE9 or Firefox 3, but results in strange looking URL's. See
406
406
  the README for History.js for more details on that behaviour.
407
407
 
408
+ ### turbolinks support
409
+
410
+ [turbolinks](https://github.com/rails/turbolinks) provides capabilities similar to the push-state fragment Ajax described above. However, rather than updating fragments, it updates the entire page. This makes it slightly slower but does not require any code modification.
411
+
412
+ Turbolinks is not compatible with the [bottom-load-javascript](http://cookbook-1.4.hobocentral.net/manual/changes20#bottomloading_javascript) option.
413
+
408
414
  ### plugin generators
409
415
  {.part}
410
416
 
@@ -496,6 +502,8 @@ Turning on bottom-load will prevent Rails from splitting front.js into
496
502
  multiple files even if you enable config.assets.debug in your
497
503
  environment.
498
504
 
505
+ bottom-load-javascript is incompatible with turbolinks.
506
+
499
507
  ### allowing errors in parts
500
508
  {.todo}
501
509
 
@@ -506,9 +514,10 @@ This behaviour may now be overridden by using the 'errors-ok'
506
514
  attribute on your form. (or formlet or whatever other tag initiates
507
515
  the Ajax call).
508
516
 
509
- The 'errors-ok' attribute is processed in update_response. If you've
510
- supplied a block to hobo_update you will be responsible for
511
- implementing this functionality yourself.
517
+ The 'errors-ok' attribute is processed in update_response. If you
518
+ render or redirect inside a block to hobo_update you will be
519
+ responsible for implementing this functionality yourself, or calling
520
+ update_response to do it for you.
512
521
 
513
522
  ### AJAX file uploads
514
523
  {.todo}
@@ -768,23 +777,13 @@ field is named "project.title", parse_sort_param will sort on the
768
777
  column "projects.title".
769
778
 
770
779
  ### controller actions
771
- {.todo}
780
+ {.done}
772
781
 
773
782
  Hobo no longer attempts to perform its part-based AJAX actions when
774
783
  sent an xhr request. Instead, Hobo performs part-based AJAX when
775
784
  params[:render] is set.
776
785
 
777
- The signature for the function update_response and friends has changed. This should make it useful for use in your application. It can be used like this:
778
-
779
- def update
780
- hobo_update do
781
- if params[:foo]==17
782
- render_my_way
783
- else
784
- update_response # let Hobo handle it all
785
- end
786
- end
787
- end
786
+ The signature for the function update_response, index_response and friends have changed. This should make it useful for use in your application. update_response is called automatically by hobo_update if you don't render or redirect inside of the block parameter hobo_update.
788
787
 
789
788
  ### default controller actions now use respond_with
790
789
 
@@ -798,6 +797,24 @@ Note that the JSON and XML interfaces will only use coarse grained
798
797
  model-level permission checking rather than fine grained attribute
799
798
  level permission checking.
800
799
 
800
+ ### custom alternate formats
801
+
802
+ Hobo no longer executes an arity zero block passed to hobo controller actions inside of a respond_to block. This means that you can render formats other than html inside of an arity zero block.
803
+
804
+ hobo_show do
805
+ render something if request.format.pdf?
806
+ end
807
+
808
+ Any formats that you do not render or redirect inside the block will be handled by hobo_show via respond_with.
809
+
810
+ If your block has a parameter, the block continues to be executed inside of a respond_to.
811
+
812
+ hobo_show do |format|
813
+ format.pdf do { render something }
814
+ end
815
+
816
+ Because this is a respond_to block any formats you do not render will fall through and be handled by hobo_show's respond_with block.
817
+
801
818
  ### before-unload
802
819
  {.check}
803
820
 
@@ -849,7 +866,7 @@ the change is one I could do myself...)
849
866
  - https://github.com/tablatom/hobo/commit/e9460d336ef85388af859e5082763bfae0ad01f5
850
867
 
851
868
  ### controller changes
852
- {.todo}
869
+ {.done}
853
870
 
854
871
  Due to limitations on Ajax file uploads, multipart forms are not sent with the proper Ajax headers. If your controller action may receive multipart forms, rather than using:
855
872
 
@@ -869,7 +886,7 @@ use
869
886
  for more information see http://jquery.malsup.com/form/#file-upload
870
887
 
871
888
  ### hobo_ajax_response
872
- {.todo}
889
+ {.done}
873
890
 
874
891
  the `hobo_ajax_response` function now has a different signature.
875
892
  Standard usage doesn't supply any arguments to hobo_ajax_response.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.0.pre6
1
+ 2.0.0.pre7
@@ -123,11 +123,14 @@ module HoboRouteHelper
123
123
  poly = [options[:subsite]] + poly if options[:subsite]
124
124
 
125
125
  begin
126
- url = polymorphic_path(poly, params)
126
+ base_url = url = polymorphic_path(poly, params)
127
127
  # validate URL, since polymorphic URL may return a URL for a
128
128
  # different method
129
129
  # use starts_with because recognize path may return new_for_owner, for example
130
- recognized_params = Rails.application.routes.recognize_path(url, {:method => options[:method]})
130
+ if Rails.application.config.action_controller.relative_url_root
131
+ base_url = url.gsub(/^#{Rails.application.config.action_controller.relative_url_root}/, "")
132
+ end
133
+ recognized_params = Rails.application.routes.recognize_path(base_url, {:method => options[:method]})
131
134
  if recognized_params[:action] == action.to_s
132
135
  url
133
136
  else
@@ -12,7 +12,7 @@ es:
12
12
  index:
13
13
  # if you uncomment the following you will loose the automatic selection of dinamically pluralized nav-tabs
14
14
  # if you need a different title you should implement a different way to select the tab on your own
15
- #title: "Indice %{model}"
15
+ #title: "Índice %{model}"
16
16
  heading: "Índice %{model}"
17
17
 
18
18
  new:
@@ -24,7 +24,7 @@ es:
24
24
  heading: "%{model} %{name}"
25
25
  back_link: "Atrás"
26
26
  edit_link: "Actualizar %{model}"
27
- new_link: "Nuevo Registro %{model}"
27
+ new_link: "Nuevo registro %{model}"
28
28
  add_form_heading: "Añadir %{model}"
29
29
 
30
30
  edit:
@@ -41,56 +41,57 @@ es:
41
41
  subheading: "Para:"
42
42
 
43
43
  new_for_owner:
44
- title: "Nuevo Registro de %{model} para"
45
- heading: "Nuevo Registro de %{model}"
44
+ title: "Nuevo registro de %{model} para"
45
+ heading: "Nuevo registro de %{model}"
46
46
  subheading: "Para:"
47
47
 
48
48
  login:
49
- title: "Iniciar Sesión"
50
- heading: "Iniciar Sesión"
51
- email_address: &email_address "Correo Eléctronico"
49
+ title: "Iniciar sesión"
50
+ heading: "Iniciar sesión"
51
+ email_address: &email_address "Correo eléctronico"
52
52
  name: "Nombre"
53
53
  password: "Contraseña"
54
54
  remember_me: "Recuerda mis datos"
55
55
  login: "Identificación"
56
- signup: "Inscripción"
56
+ signup: "Registro"
57
57
  forgot_password: &forgot_password "¿Contraseña olvidada?"
58
58
 
59
59
  signup:
60
- title: "Inscripción"
61
- heading: "Inscribir Nuevo Usuario"
60
+ title: "Registro"
61
+ heading: "Registrar nuevo usuario"
62
62
 
63
63
  forgot_password:
64
64
  title: *forgot_password
65
65
  heading: *forgot_password
66
- text: "Ingresa la dirección de tu Correo Eléctronico que utilizaste cuando te inscribiste.
67
- Te enviaremos un Correo Eléctronico que podrás utilizar para generar una nueva contraseña."
66
+ text: "Introduzca la dirección de correo electrónico mediante la cual se registró. Le enviaremos un correo con instrucciones para generar una nueva contraseña."
67
+
68
+
68
69
  email_address: *email_address
69
- send: "Enviar"
70
+ send: "Enviar nueva contraseña"
70
71
 
71
72
  forgot_password_sent:
72
- title: "Contraseña olvidada - Correo Eléctronico enviado"
73
- heading: "Contraseña olvidada - Correo Eléctronico enviado"
73
+ title: "Contraseña olvidada - Correo eléctronico enviado"
74
+ heading: "Contraseña olvidada - Correo eléctronico enviado"
74
75
  text: "El mensaje con las instrucciones para generar una nueva contraseña ha sido enviado a %{email_address}
75
76
  Si no lo recibe, por favor verifique el filtro anti-spam."
76
77
 
77
78
  account_disabled_page:
78
- title: "Cuenta Desactivada"
79
- heading: "Cuenta Desactivada"
80
- text: "Su cuenta está desactivada en ese momento."
79
+ title: "Cuenta desactivada"
80
+ heading: "Cuenta desactivada"
81
+ text: "Su cuenta está desactivada en este momento."
81
82
 
82
83
  account_page:
83
- title: "Tu Perfil"
84
- heading: "Tu Perfil"
85
- new_password: "Nueva Contraseña"
86
- confirm_new_password: "Confirmación Nueva Contraseña"
84
+ title: "Tu perfil"
85
+ heading: "Tu perfil"
86
+ new_password: "Nueva contraseña"
87
+ confirm_new_password: "Confirmación nueva contraseña"
87
88
 
88
89
  # default hobo action translation
89
90
  actions:
90
- new: "Nuevo Registro de %{model}"
91
+ new: "Nuevo registro de %{model}"
91
92
  create: "Crear %{model}"
92
- previous: "Precedente"
93
- next: "Próxima"
93
+ previous: "Anterior"
94
+ next: "Siguiente"
94
95
  add: "Añadir"
95
96
  show_all: "Muestra todos %{model}..."
96
97
  delete: "Borrar %{model}"
@@ -102,12 +103,12 @@ es:
102
103
  back_to_parent: "Volver a %{parent} %{name}"
103
104
  send: "Enviar"
104
105
  remove: "Eliminar"
105
- signup: "Inscripción"
106
+ signup: "Registro"
106
107
  login: "Iniciar Sesión"
107
108
  logout: "Terminar Sesión"
108
109
  logged_in_as: "%{name}"
109
110
  account: "Perfil"
110
- save_account: "Guarda Tu Perfil"
111
+ save_account: "Guarda tu perfil"
111
112
 
112
113
  # default hobo message translation
113
114
  messages:
@@ -119,16 +120,16 @@ es:
119
120
  transition:
120
121
  error: "La transición %{name} no se pudo ejecutar.\n%{errors}"
121
122
  update:
122
- no_attribute_error: "Ninguna actualización esta especificada en los parámetros"
123
+ no_attribute_error: "Ninguna actualización está especificada en los parámetros"
123
124
  success: "Los cambios a %{model} han sido guardados"
124
125
  error: "Ha habido un problema con ese cambio.\n%{errors}"
125
126
  destroy:
126
- success: "La borradura de %{model} ha sido tenido éxito."
127
+ success: "La eliminación de %{model} ha sido tenido éxito."
127
128
  signup:
128
- success: "¡Gracias por inscribirse!"
129
+ success: "¡Gracias por registrarte!"
129
130
  must_activate: "Tiene que activar la cuenta antes de iniciar la sesión. Por favor verifique su correo eléctronico."
130
131
  login:
131
- success: "La sesión ha iniciado."
132
+ success: "Ha iniciado la sesión."
132
133
  error: "¡No se ingresaron %{login} y Contraseña válidos!"
133
134
  logout: "La sesión ha terminado."
134
135
  reset_password: "Tu contraseña ha sido reiniciada."
@@ -138,7 +139,7 @@ es:
138
139
  validate_password: "debe contener al menos 6 caracteres, letras mayúsculas y minúsculas"
139
140
  current_password_is_not_correct: "no está correcta"
140
141
  you_are_site_admin: "Ahora usted es el administrador del sitio."
141
- you_signed_up: "Usted se inscribió."
142
+ you_signed_up: "Usted se registró."
142
143
  none: "No hay %{model} disponibles."
143
144
  confirm: "¿Está seguro?"
144
145
 
@@ -159,7 +160,7 @@ es:
159
160
  # default hobo form translation
160
161
  form:
161
162
  new:
162
- heading: "Nuevo Registro de %{model}"
163
+ heading: "Nuevo registro de %{model}"
163
164
  error:
164
165
  heading: "Ocurrió el siguiente error:"
165
166
  select_many:
@@ -186,7 +187,7 @@ es:
186
187
 
187
188
  admin:
188
189
  subsite_name: "Administración"
189
- invite_new_user: "Invitar Nuevo Usuario"
190
+ invite_new_user: "Invitar nuevo usuario"
190
191
 
191
192
  subsite:
192
193
  back_link: "Sitio Principal"
@@ -429,12 +429,12 @@ module Hobo
429
429
 
430
430
  def response_block(&b)
431
431
  if b
432
- respond_to do |format|
433
- if b.arity == 1
432
+ if b.arity == 1
433
+ respond_to do |format|
434
434
  yield format
435
- else
436
- format.html { yield }
437
435
  end
436
+ else
437
+ yield
438
438
  end
439
439
  performed?
440
440
  end
@@ -511,7 +511,7 @@ module Hobo
511
511
  end
512
512
 
513
513
  def hobo_new(record=nil, &b)
514
- self.this = record || model.user_new(current_user, attribute_parameters)
514
+ self.this ||= record || model.user_new(current_user, attribute_parameters)
515
515
  response_block(&b) || show_response
516
516
  end
517
517
 
@@ -535,7 +535,7 @@ module Hobo
535
535
 
536
536
  def hobo_new_for(owner, record=nil, &b)
537
537
  owner, association = find_owner_and_association(owner)
538
- self.this = record || association.user_new(current_user, attribute_parameters)
538
+ self.this ||= record || association.user_new(current_user, attribute_parameters)
539
539
  response_block(&b) || show_response
540
540
  end
541
541
 
@@ -1,12 +1,14 @@
1
1
  module Enumerable
2
2
  def group_by_with_metadata(&block)
3
3
  r=group_by_without_metadata(&block)
4
- r.each do |k,v|
5
- v.origin = origin
6
- v.origin_attribute = origin_attribute
7
- v.member_class = member_class
4
+ if respond_to?(:origin)
5
+ r.each do |k,v|
6
+ v.origin = origin
7
+ v.origin_attribute = origin_attribute
8
+ v.member_class = member_class
9
+ end
8
10
  end
9
11
  r
10
12
  end
11
13
  alias_method_chain :group_by, :metadata
12
- end
14
+ end
@@ -17,7 +17,6 @@ module Hobo
17
17
 
18
18
  base.class_eval do
19
19
  inheriting_cattr_reader :default_order
20
- alias_method_chain :attributes=, :hobo_type_conversion
21
20
 
22
21
  cattr_accessor :hobo_controller
23
22
  self.hobo_controller = {}
@@ -356,17 +355,6 @@ module Hobo
356
355
  end
357
356
 
358
357
 
359
- def attributes_with_hobo_type_conversion=(attributes, guard_protected_attributes=true)
360
- converted = attributes.map_hash { |k, v| convert_type_for_mass_assignment(self.class.attr_type(k), v) }
361
- # Avoid passing this third argument if possible, to avoid a deprecation warning in Rails 3.1
362
- if guard_protected_attributes
363
- send(:attributes_without_hobo_type_conversion=, converted)
364
- else
365
- send(:attributes_without_hobo_type_conversion=, converted, true)
366
- end
367
- end
368
-
369
-
370
358
  # We deliberately give these three methods unconventional (java-esque) names to avoid
371
359
  # polluting the application namespace
372
360
 
@@ -412,53 +400,6 @@ module Hobo
412
400
  "#{self.class.model_name.human} #{id}"
413
401
  end
414
402
  end
415
-
416
-
417
- private
418
-
419
-
420
- def convert_type_for_mass_assignment(field_type, value)
421
- if !field_type.is_a?(Class)
422
- value
423
-
424
- elsif field_type <= Date
425
- if value.is_a? Hash
426
- parts = %w{year month day}.map{|s| value[s].to_i}
427
- if parts.include?(0)
428
- nil
429
- else
430
- begin
431
- Date.new(*parts)
432
- rescue ArgumentError => ex
433
- Time.time_with_datetime_fallback(ActiveRecord::Base.default_timezone, *parts).to_date
434
- end
435
- end
436
- else
437
- value
438
- end
439
-
440
- elsif field_type <= Time || field_type <= ActiveSupport::TimeWithZone
441
- if value.is_a? Hash
442
- parts = %w{year month day hour minute second}.map{|s| value[s].to_i}
443
- if parts[0..2].include?(0)
444
- nil
445
- else
446
- field_type <= Time ? Time.utc(*parts) : Time.zone.local(*parts)
447
- end
448
- else
449
- value
450
- end
451
-
452
- elsif field_type <= Hobo::Boolean
453
- (value.is_a?(String) && value.strip.downcase.in?(['0', 'false']) || value.blank?) ? false : true
454
-
455
- else
456
- # no conversion
457
- value
458
- end
459
- end
460
-
461
-
462
403
  end
463
404
 
464
405
  end
@@ -293,6 +293,7 @@ module Hobo
293
293
  klass = @klass
294
294
  def_scope do |*args|
295
295
  field, asc = args
296
+ field ||= ""
296
297
  type = klass.attr_type(field)
297
298
  if type.nil? #a virtual attribute from an SQL alias, e.g., 'total' from 'COUNT(*) AS total'
298
299
  colspec = "#{field}" # don't prepend the table name
@@ -321,7 +322,7 @@ module Hobo
321
322
  def_scope do |query, *fields|
322
323
  match_keyword = %w(PostgreSQL PostGIS).include?(::ActiveRecord::Base.connection.adapter_name) ? "ILIKE" : "LIKE"
323
324
 
324
- words = query.split
325
+ words = (query || "").split
325
326
  args = []
326
327
  word_queries = words.map do |word|
327
328
  field_query = '(' + fields.map { |field|
@@ -97,7 +97,7 @@ module Hobo
97
97
  end
98
98
 
99
99
  def account_active?
100
- lifecycle.active_state?
100
+ !self.class.has_lifecycle? || lifecycle.active_state?
101
101
  end
102
102
 
103
103
  # Encrypts the password with the user salt
@@ -0,0 +1,123 @@
1
+ Hobo's Miscellaneous Controller Extensions
2
+ {.document-title}
3
+
4
+ This chapter of the Hobo Manual describes Hobo's controller extensions.
5
+
6
+ Contents
7
+ {.contents-heading}
8
+
9
+ - contents
10
+ {:toc}
11
+
12
+ doctest: prepare testapp environment
13
+ doctest_require: '../prepare_testapp'
14
+ {.hidden}
15
+
16
+ # Authentication support
17
+
18
+ ## authorized?
19
+
20
+ This method checks if the user is authorized. It returns true by default. Override this method in your controllers if you want to restrict access to only a few actions or if you want to check if the user has the correct rights.
21
+
22
+ Example:
23
+
24
+ # only allow nonbobs
25
+ def authorized?
26
+ current_user.login != "bob"
27
+ end
28
+
29
+ ## login_required
30
+
31
+ This is used as a filter to control authentication.
32
+
33
+ To require logins for all actions, use this in your controllers:
34
+
35
+ before_filter :login_required
36
+
37
+ To require logins for specific actions, use this in your controllers:
38
+
39
+ before_filter :login_required, :only => [ :edit, :update ]
40
+
41
+ To skip this in a subclassed controller:
42
+
43
+ skip_before_filter :login_required
44
+
45
+
46
+
47
+ ## store_location
48
+
49
+ Store the URI of the current request in the session. We can return to this location by calling #redirect_back_or_default.
50
+
51
+
52
+
53
+ ## redirect_back_or_default(default)
54
+
55
+ Redirect to the URI stored by the most recent store_location call or to the passed default.
56
+
57
+
58
+
59
+
60
+ ## login_from_cookie and authenticated_user_from_cookie
61
+
62
+ When called with before_filter, `login_from_cookie` will call `authenticated_user_from_cookie` to check for
63
+ an `auth_token` cookie, and if the result is appropiate, it will log the user in.
64
+
65
+
66
+
67
+
68
+ ## create_auth_cookie
69
+
70
+ Populates `cookies[:auth_token]` with `current_user` data.
71
+
72
+
73
+
74
+ # Cache
75
+
76
+ ## expire_swept_caches_for(obj, attr=nil)
77
+
78
+ This method is to be used in the controller as a partner to the `<swept-cache>` tag.
79
+ Refer to the `<swept-cache>` taglib for more information.
80
+
81
+
82
+
83
+ # Model
84
+
85
+ ## Introduction to the Hobo Model Controller Module
86
+
87
+ This module uses `def included(base)` to run some code in the context of the current controller. Some interesting stuff:
88
+ * Defines @auto_actions as an empty hash if it's not already defined.
89
+ * Runs `extend ClassMethods` to add the ClassMethods module to the current controller.
90
+ * Adds a couple of helpers: `:model, :current_user`
91
+ * Rescues from some errors: `ActiveRecord::RecordNotFound, ActiveRecord::RecordNotFound, Hobo::Model::Lifecycles::LifecycleKeyError`
92
+ * Loads some subsite magic
93
+
94
+ The rest of this section will talk about the ClassMethods added to the controller.
95
+
96
+
97
+ ## model_name and model
98
+
99
+ `model_name` returns `model.name.underscore`
100
+
101
+ `model` returns `@model` or `controller_name.camelcase.singularize.constantize`
102
+
103
+
104
+ ## autocomplete
105
+
106
+ This is the action called by the `<name-one>` tag to autocomplete results. See Autocompleters section in the controller manual.
107
+
108
+
109
+ ## web_method
110
+
111
+ See `Web methods` sections in the Controller manual.
112
+
113
+
114
+
115
+ ## auto_actions
116
+
117
+ See `Selecting the automatic actions` in the Controller manual.
118
+
119
+
120
+
121
+ ## def_lifecycle_actions
122
+
123
+ See Lifecycles section in the Controller manual.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hobo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre6
4
+ version: 2.0.0.pre7
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-15 00:00:00.000000000 Z
12
+ date: 2012-12-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hobo_support
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 2.0.0.pre6
21
+ version: 2.0.0.pre7
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 2.0.0.pre6
29
+ version: 2.0.0.pre7
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: hobo_fields
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -34,7 +34,7 @@ dependencies:
34
34
  requirements:
35
35
  - - '='
36
36
  - !ruby/object:Gem::Version
37
- version: 2.0.0.pre6
37
+ version: 2.0.0.pre7
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - '='
44
44
  - !ruby/object:Gem::Version
45
- version: 2.0.0.pre6
45
+ version: 2.0.0.pre7
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: dryml
48
48
  requirement: !ruby/object:Gem::Requirement
@@ -50,7 +50,7 @@ dependencies:
50
50
  requirements:
51
51
  - - '='
52
52
  - !ruby/object:Gem::Version
53
- version: 2.0.0.pre6
53
+ version: 2.0.0.pre7
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,7 +58,7 @@ dependencies:
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 2.0.0.pre6
61
+ version: 2.0.0.pre7
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: will_paginate
64
64
  requirement: !ruby/object:Gem::Requirement
@@ -345,6 +345,7 @@ files:
345
345
  - lib/hobo/rapid/taglibs/rapid.dryml
346
346
  - lib/hobo/routes.rb
347
347
  - lib/hobo/undefined.rb
348
+ - test/doctest/hobo/controller.rdoctest
348
349
  - test/doctest/hobo/hobo_helper.rdoctest
349
350
  - test/doctest/hobo/lifecycles.rdoctest
350
351
  - test/doctest/hobo/model.rdoctest