Skip to content

Instantly share code, notes, and snippets.

View jmbejar's full-sized avatar

Jorge Bejar jmbejar

  • WyeWorks
  • Montevideo, Uruguay
  • X @jmbejar
View GitHub Profile
@jmbejar
jmbejar / 00-notes.md
Last active August 26, 2016 19:56
Entries Listing & Form - Rails
  • Diff en AccountsController
  • EntriesController
  • Account#entries_with_balance (método del modelo)
  • Template del account/show (listado) y entries/new
  • Entries Helper (algunos métodos)

Cosas que no mostramos

@jmbejar
jmbejar / 00-notes.md
Last active August 29, 2016 19:21
Account Form - Rails
  • Accounts controller
  • Vistas:
    • new
    • _modal y _modal_content
    • _form
  • currencies_options helper
  • Vistas con respuesta js desde el servidor:
    • create.js.erb
    • update.js.erb
  • error.js.erb

Results of running self.class.ancestors in different types of controllers.

Please note the position of ActionView::Rendering with respect to the rendering modules that are present in all cases (ActionController::Renderers::All, ActionController::Renderers and ActionController::Rendering)

1- Controller inheriting from ActionController::Base

[
 ...
 ActionController::Renderers::All,
// Debe implementarse una clase cuyo nombre es HomeCoach o AwayCoach, dependiendo de si es el equipo azul o el rojo.
class HomeCoach {
// Es obligatorio definir el método "name" retornando un string
name() {
return 'Uruguay';
}
// Es oabligatorio definir el método "players" retornando un array con 10 objetos que tiene un "type" y un "name"
// Uno debe ser de tipo captain, 3 de tipo fast y 6 de tipo averare. Si no son esas cantidades exactas, el juego dará error.
class SubscriptorsController < ActionController::Metal
ActionController::Base.without_modules(:Flash, :Cookies).each do |left|
p left
include left
end
include Rails.application.routes.url_helpers
# Define some internal variables that should not be propagated to the view.
PROTECTED_IVARS = AbstractController::Rendering::DEFAULT_PROTECTED_INSTANCE_VARIABLES + [
@jmbejar
jmbejar / gist:1134210
Created August 9, 2011 14:36
render_liquid! updated
diff --git a/lib/liquid_renderable.rb b/lib/liquid_renderable.rb
index 0f66188..117e765 100644
--- a/lib/liquid_renderable.rb
+++ b/lib/liquid_renderable.rb
@@ -2,7 +2,7 @@ module LiquidRenderable
CLONE_TITLE_REGEXP = %r{(\d+)$}
- def render_liquid!(controller, channel, edit, draft = false)
+ def render_liquid!(controller, channel, edit, draft = false, locals = {})