I hereby claim:
- I am johnlane on github.
- I am johnlane (https://keybase.io/johnlane) on keybase.
- I have a public key ASDE5-a54ZM6flDHH8atfeVPVgu1sXGE16_2aNJ4OPnG-go
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| ----------------------------------------------------------------- | |
| VERSION INFORMATION | |
| gpg (GnuPG) 2.1.17 | |
| libgcrypt 1.7.5 | |
| Copyright (C) 2016 Free Software Foundation, Inc. | |
| License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html> | |
| This is free software: you are free to change and redistribute it. | |
| There is NO WARRANTY, to the extent permitted by law. | |
| Home: /home/john/.gnupg |
| #!/bin/sh | |
| # | |
| export GNUPGHOME | |
| echo ----------------------------------------------------------------- | |
| echo VERSION INFORMATION | |
| gpg --version | |
| uname -vimposr |
| $(document).on('ready page:load ajaxComplete', function() { | |
| $('textarea.wysiwyg').each(function() { | |
| var textarea = $(this) | |
| textarea.hide().uniqueId(); | |
| var textarea_id = textarea[0].id; | |
| var textarea_class = textarea[0].className; | |
| var wysiwyg_id = "wysiwyg_" + textarea_id; | |
| var wysiwyg_class = textarea_class + " wysiwyg"; |
| # in-ruby-is-it-possible-to-move-a-module-up-the-ancestor-chain | |
| # http://stackoverflow.com/questions/36799396 | |
| module A | |
| def hiya(str) | |
| puts "ho #{str}" | |
| end | |
| def if_what? | |
| end | |
| end |
The effect of multiple inheritance can be achieved by using modules.
First define the ActiveRecord objects like this:
class Topic < ActiveRecord::Base; end
class Location < ActiveRecord::Base; end
There is no longer a base Tag abstract class, allowing Tag to be defined as a module like this (app/concepts/tag/crud.rb):
module Tag
These notes record my attempts to understand how and when to populate a Trailblazer contract. They may be incomplete, inaccurate or just plain wrong. They may also be right; I hope they are! Comments are welcome.
It all began with the requirement to seed a presenting contract from the inbound request. Having looked for answers in the Trailblazer book and on Gitter (there was a similar conversation on the 25th September), taking
The application can behave differently based on the request URL by presenting a diferent 'site' experience to the end-user, who may also choose from the locales (language presentations) that the site supports.The Session manages this: it's a PORO plus some Trailblazer operations. It keeps state for the current request including current user, the Rails session and site and locale selections. It's established with a Session::Create operation before processing a request.
The Session does not persist across requests, except for data placed in its persistent store, for which the Rails session is used (but another Hash-like object could be used instead).
The Session is established in the ApplicationController:
before_action do
Session::Create.reject(params.merge(store: session, host: request.host,
preferred_locales: get_preferred_locales_from_http_request)) do |op|| # app/concepts/widget/cell.rb | |
| # A very basic "Widget" that is a container of Cell objects | |
| # When rendered, it recursively renders all cells that it | |
| # contains. | |
| class Widget < Cell::Concept | |
| attr_reader :parent | |
| attr_reader :children | |
| # Create a new widget |