<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>hi, it&#39;s mike</title>
    <link>https://mike.puddingtime.org/tags/rails/</link>
    <description>Recent content on hi, it&#39;s mike</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <managingEditor>mike@puddingtime.org (mike)</managingEditor>
    <webMaster>mike@puddingtime.org (mike)</webMaster>
    <copyright>© 2026, mike</copyright>
    <lastBuildDate>Mon, 14 Mar 2016 06:50:11 +0000</lastBuildDate>
    <atom:link href="https://mike.puddingtime.org/tags/rails/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Priorities v0.6</title>
      <link>https://mike.puddingtime.org/posts/2016-03-14-priorities-v0-6/</link>
      <pubDate>Mon, 14 Mar 2016 06:50:11 +0000</pubDate><author>mike@puddingtime.org (mike)</author>
      <guid>https://mike.puddingtime.org/posts/2016-03-14-priorities-v0-6/</guid>
      
      <description>I got to spend a few hours on Priorities over the weekend. I put one thing back that the older app had, and added something new.
The thing that went back in was a conception of “effort” and a calculated combination of “effort” + “support” that yields something I’m calling “burden” internally, and …</description>
      <content:encoded><![CDATA[<p>I got to spend a few hours on Priorities over the weekend. I put one thing back that the older app had, and added something new.</p>
<p>The thing that went back in was a conception of &ldquo;effort&rdquo; and a calculated combination of &ldquo;effort&rdquo; + &ldquo;support&rdquo; that yields something I&rsquo;m calling &ldquo;burden&rdquo; internally, and &ldquo;cost&rdquo; in the UI. I could change it to one or the other, but I haven&rsquo;t made up my mind which I like better, so I&rsquo;m keeping it that way so the sense of misalignment will eventually spur me to a decision.</p>
<p>The idea of &ldquo;effort&rdquo; and &ldquo;cost&rdquo; is to capture the idea that not all goals take the same amount of work. By adding up the effort expended to work on the goal, and the level of relative support it&rsquo;s getting, you can reflect a sense of what it actually costs to work on that goal.</p>
<p>The new thing I added is a little dashboard for goal health on each user&rsquo;s home page:</p>
<p><a href="https://media.puddingtime.org/archive/mph.puddingbowl.org/wordpress/wp-content/uploads/2016/03/goals_status.jpg" class="glightbox" data-gallery="post-2690decf0edc9ac408e4cf1f88a9bce3"><img src="https://media.puddingtime.org/archive/mph.puddingbowl.org/wordpress/wp-content/uploads/2016/03/goals_status.jpg" alt="" loading="lazy"></a></p>
<p>It&rsquo;s just a simple tally of the number of goals in each state of health (good, medium, poor, unknown). If you&rsquo;re using Priorities with other users who&rsquo;ve shared lists with you, the tally shows up in your &ldquo;Shared&rdquo; list of lists, as well.</p>
<p>I guess there&rsquo;s one other change: I&rsquo;m assuming postgres for the app db in all environments. There are instructions in the database.yml file for how to set up sqlite as the db backend if you&rsquo;d prefer that.</p>
<p>Source, as always, is <a href="https://github.com/pdxmph/priorities">up on GitHub</a>. I&rsquo;m also hosting a version I&rsquo;m happy to share with others. Feel free to ping me if you&rsquo;d like to learn how to get a login.</p>
<p>#priorities #rails #work</p>
<p><em><a href="mailto:mike@puddingtime.org?subject=Re%3A%20Priorities%20v0.6">Drop a line about this</a>.</em></p>]]></content:encoded>
    </item>
    <item>
      <title>Priorities v0.5</title>
      <link>https://mike.puddingtime.org/posts/2016-03-07-priorities-v0-5/</link>
      <pubDate>Mon, 07 Mar 2016 08:10:13 +0000</pubDate><author>mike@puddingtime.org (mike)</author>
      <guid>https://mike.puddingtime.org/posts/2016-03-07-priorities-v0-5/</guid>
      
      <description>Oh, feature creep.
So, last I wrote about it, I’d put together this little prioritization tool based on some thinking I’d done about priorities. I reused a bunch of code from a previous project to get to a sort of “good enough” state.
Then I started thinking about the ways you could extend that …</description>
      <content:encoded><![CDATA[<p>Oh, feature creep.</p>
<p>So, <a href="http://mph.puddingbowl.org/2016/02/priorities-v0-01/">last I wrote about it</a>, I&rsquo;d put together this little prioritization tool based on some <a href="http://mph.puddingbowl.org/2016/02/thinking-about-priorities/">thinking I&rsquo;d done about priorities</a>. I reused a bunch of code from a previous project to get to a sort of &ldquo;good enough&rdquo; state.</p>
<p>Then I started thinking about the ways you could extend that model into a bigger environment, like a company, which has several organizational levels besides &ldquo;teams.&rdquo; So I did a huge cleanup of the legacy code in Priorities and started work on something that would be more appropriate to modeling goals in a really large environment.</p>
<p>In the end, though, I realized a few things:</p>
<ol>
<li>I don&rsquo;t really own that other project anymore. I mean, it&rsquo;s &ldquo;mine,&rdquo; but I&rsquo;m sharing it with people who&rsquo;d like to do more with it.</li>
<li>The places I was taking that other tool were being shaped by the company I work for.</li>
<li>The thing I set out to do with Priorities was meant to be really simple. There are ways to extend the idea, but they leave the tool in a place where it&rsquo;s harder to approach for someone who isn&rsquo;t working in the same company as me.</li>
</ol>
<p>So this weekend I just started over with Priorities. Since I&rsquo;d been working on an alternate app that needed a bunch of the old Priorities code cleaned up, I had a pretty decent set of models and templates, so it was really easy to reuse a lot of the thinking, but keeping the new version to something quite simple.</p>
<p>The older version of Priorities, the one I wrote from all the legacy code, lives in its own branch now, since I learned at least one person had downloaded it and was using it.</p>
<p>The new version is in a new master branch <a href="https://github.com/pdxmph/priorities/">on the project</a>. For this version, I did a few things:</p>
<p>I changed the &ldquo;Team&rdquo; model to &ldquo;Lists.&rdquo; Not everybody&rsquo;s managing a team. You can still name a list after a team, or whatever you like, but by talking about
&ldquo;lists,&rdquo; it&rsquo;s more of a tool for anybody, from a sole proprietor to a company.</p>
<p>I also began working toward making lists private. The old version let everybody see everybody else&rsquo;s lists. The new version will still allow that, but you have to go looking. Once I get the basic features polished up, I&rsquo;ll take a pass back through to require ownership to view a list. Once that&rsquo;s done, I&rsquo;ll work on allowing owners to set their lists to be public.  For now, the app guides you toward just looking at your own stuff.</p>
<p>There&rsquo;s a little help if you&rsquo;re a new user and don&rsquo;t have any lists set up:</p>
<p><a href="https://media.puddingtime.org/archive/mph.puddingbowl.org/wordpress/wp-content/uploads/2016/03/Priorities__Home.png" class="glightbox" data-gallery="post-6934599b7b12129adfa8b073029af20b"><img src="https://media.puddingtime.org/archive/mph.puddingbowl.org/wordpress/wp-content/uploads/2016/03/Priorities__Home.png" alt="" loading="lazy"></a></p>
<p>There&rsquo;s also a prompt once you make a list and don&rsquo;t have any goals:</p>
<p><a href="https://media.puddingtime.org/archive/mph.puddingbowl.org/wordpress/wp-content/uploads/2016/03/Priorities_.png" class="glightbox" data-gallery="post-6934599b7b12129adfa8b073029af20b"><img src="https://media.puddingtime.org/archive/mph.puddingbowl.org/wordpress/wp-content/uploads/2016/03/Priorities_.png" alt="" loading="lazy"></a></p>
<p>If you&rsquo;re interested in giving it a spin, you&rsquo;ll need Ruby and Bundler on your system:</p>
<ol>
<li><code>sudo gem install bundler</code>  (no <code>sudo</code> if you&rsquo;re using rbenv or rvm)</li>
<li>Download Priorities from GitHub: <code>git clone https://github.com/pdxmph/priorities.git</code></li>
<li>In the download directory, install the needed gems: <code>bundle install</code></li>
<li>Set up the database: <code>bundle exec rake db:migrate</code></li>
<li>Run the app: <code>bundle exec rails s</code></li>
<li><a href="http://localhost:3000">Visit the app in your browser.</a></li>
</ol>
<p>Since it&rsquo;s running in dev mode, it&rsquo;s going to be sort of slow on load.</p>
<p>The TODOs are pretty simple at this point:</p>
<ul>
<li>Do more to ensure the privacy of individual lists.</li>
<li>Clean out the remnants of the old team model.</li>
<li>Put it somewhere private but not secret so people who don&rsquo;t want to run their own instance can use it.</li>
</ul>
<p>Then there are a few things to think about:</p>
<ul>
<li>Adding info pages for each goal.</li>
<li>Adding notes for each goal.</li>
<li>Adding back the comparison data for goals.</li>
<li>Figuring out if there&rsquo;s value in expanding the user model to have &ldquo;groups&rdquo; for shared lists.</li>
</ul>
<p>#priorities #rails #ruby #work</p>
<p><em><a href="mailto:mike@puddingtime.org?subject=Re%3A%20Priorities%20v0.5">Drop a line about this</a>.</em></p>]]></content:encoded>
    </item>
    <item>
      <title>Docs Decomposer Week 7</title>
      <link>https://mike.puddingtime.org/posts/2015-04-06-docs-decomposer-week-7/</link>
      <pubDate>Mon, 06 Apr 2015 11:45:27 +0000</pubDate><author>mike@puddingtime.org (mike)</author>
      <guid>https://mike.puddingtime.org/posts/2015-04-06-docs-decomposer-week-7/</guid>
      
      <description> This weekend I solved a problem I’ve been bothered by for weeks: Given a list of pages with a dynamic priority or risk button on each row, the sortable tables didn’t reflect changes in priority or risk until I reloaded the page. It felt good to see that one go down, and it felt good to drop a bunch …</description>
      <content:encoded><![CDATA[<div style='position: relative; padding-bottom: 76%; height: 0; overflow: hidden;'><iframe id='iframe' src='http://flickrit.com/slideshowholder.php?height=75&size=big&setId=72157651366257489&caption=on&theme=1&thumbnails=0&transition=0&layoutType=responsive&sort=0' scrolling='no' frameborder='0'style='width:100%; height:100%; position: absolute; top:0; left:0;' ></iframe></div>
<p>This weekend I solved a problem I&rsquo;ve been bothered by for weeks: Given a list of pages with a dynamic priority or risk button on each row, the sortable tables didn&rsquo;t reflect changes in priority or risk until I reloaded the page. It felt good to see that one go down, and it felt good to drop a bunch of lines of code in the process.</p>
<p>So, I think we&rsquo;re done here. Or at least, we&rsquo;re in a place where I can do everything with this tool I wanted to do, plus a few things I hadn&rsquo;t thought of at the time.</p>
<p>I didn&rsquo;t keep very close track of my time. If I had to guess, I think I spent somewhere around 40-50 hours, or an average of an hour a day from my first commit on February 13. The vast majority of that time was here and there on weekends, but I put in a few lunches, too. It occupied a funny space: I didn&rsquo;t want to devote <em>work</em> work to it in case I got stuck and couldn&rsquo;t see it through. So it felt better to file it under &ldquo;hobby that may prove useful.&rdquo;</p>
<p>Other stuff I finished up this weekend:</p>
<ul>
<li>Some rake automation, which makes setting everything up pretty quick.</li>
<li>A HTML reimport button, to refresh the contents of a page if the underlying content in the git repo hasn&rsquo;t been recently refreshed.</li>
<li>User pages, so it&rsquo;s possible to look up a user and all their commented or flagged pages.</li>
<li>Sortable tables that work.</li>
<li>Unicorn/nginx, which was ops&rsquo; recommended approach to get this thing onto an internal box.</li>
</ul>
<p>Stuff I&rsquo;d like to do next:</p>
<ul>
<li>Connecting Devise, which I&rsquo;m using for authentication, with LDAP.</li>
<li>An &ldquo;export new metadata&rdquo; gadget, to make it easier for writers to quickly generate new YAML frontmatter that includes their tags and risk assessment, for copy and paste into documentation.</li>
<li>Revising the importers to understand our pre-release content repository and internal preview servers.</li>
<li>Write some tests. I&rsquo;ve never really done much with testing, and I&rsquo;d like to learn how. That&rsquo;d make my friend in ops, who&rsquo;s been helping me get this ready to deploy somewhere, a little happier with the whole affair.</li>
</ul>
<p>#rails</p>
<p><em><a href="mailto:mike@puddingtime.org?subject=Re%3A%20Docs%20Decomposer%20Week%207">Drop a line about this</a>.</em></p>]]></content:encoded>
    </item>
    <item>
      <title>Docs Decomposer #4</title>
      <link>https://mike.puddingtime.org/posts/2015-03-12-docs-decomposer-4/</link>
      <pubDate>Thu, 12 Mar 2015 12:36:32 +0000</pubDate><author>mike@puddingtime.org (mike)</author>
      <guid>https://mike.puddingtime.org/posts/2015-03-12-docs-decomposer-4/</guid>
      
      <description>Tags ended up going in pretty easily with acts-as-taggable-on. It allows for mutltiple kinds of tags, which means with judicious use of forms you can pretty much create any kind of taxonomy you want. I’m just using keywords for now, in a classic free-tagging setup. With judicious use of forms to …</description>
      <content:encoded><![CDATA[<p>Tags ended up going in pretty easily with <a href="https://github.com/mbleigh/acts-as-taggable-on">acts-as-taggable-on</a>. It allows for mutltiple kinds of tags, which means with judicious use of forms you can pretty much create any kind of taxonomy you want. I&rsquo;m just using keywords for now, in a classic free-tagging setup. With judicious use of forms to control input, I&rsquo;ll be able to add risk and priority tags.</p>
<p><a href="https://media.puddingtime.org/archive/mph.puddingbowl.org/wordpress/wp-content/uploads/2015/03/Docs_Decomposer.jpg" class="glightbox" data-gallery="post-16786cb0d1adff13f895fb2065a51042"><img src="https://media.puddingtime.org/archive/mph.puddingbowl.org/wordpress/wp-content/uploads/2015/03/Docs_Decomposer.jpg" alt="" loading="lazy"></a></p>
<p>Which means, I guess, that the thing is pretty much &ldquo;done&rdquo; in terms of the basic features I&rsquo;d like it to have:</p>
<ol>
<li>Individual user accounts.</li>
<li>The ability to quickly reduce a given page to just the steps and CLI instructions.</li>
<li>The ability to flag a page with a click.</li>
<li>The ability to comment on a page.</li>
<li>The ability to tag a page.</li>
</ol>
<p>Over lunch, I broke my &ldquo;don&rsquo;t do this in the office&rdquo; rule briefly to add some markup to our Jekyll templates to make it easier to grab the rendered content for import. The importer became a little simpler as a result, and the pages lose a little bit of extra nav cruft from our templates.</p>
<p>So, as it stands, I could pretty much run an inventory session for the team from this thing running on my laptop. The one thing that&rsquo;s still vexing me about it is the notion of unique and trackable page elements (ordered lists and code blocks, mostly).</p>
<p>In my Padrino prototype, each page showed the rendered content, plus a tab that showed only ordered lists and pre-blocks. Each &lt;ol&gt; and &lt;pre&gt; was checksummed, and the &ldquo;elements&rdquo; tab showed which other pages in the docs corpus had the exact same content.</p>
<p>What I really, really want is something like this:</p>
<ul>
<li>You look at the page and see a &lt;pre&gt; block that concerns you, either because it looks very perishable or could be harmful if the information has aged out.</li>
<li>You hover over the element to expose a flag or comment button, plus a little stats box that tells you where else that element appears.</li>
<li>Once you flag that element, it&rsquo;s flagged everywhere it appears in the corpus, receiving a special visual treatment.</li>
</ul>
<p>How&rsquo;s that work?</p>
<p>Everything is parsed by Nokogiri, so I can just write a little checksumming service in my Elements controller that will be seeing the same HTML whether it&rsquo;s getting it during the content import phase, or the presentation/review phase. So:</p>
<ol>
<li>User loads a page.</li>
<li>JavaScript finds each element of interest on the page (each &lt;pre&gt; and &lt;ol&gt;) and sends it over to the checksumming service.</li>
<li>The checksumming service returns a unique i.d. for the element.</li>
<li>The element gets wrapped in a div with that i.d. (in case it already has an i.d.)</li>
<li>The comment/flag widget for that element is just AJAX calls to the controller against the i.d. of the wrapper, which gets a class to reflect its flagged status.</li>
<li>Each flagged element gets either a modal/lightbox or a page with the comment history.</li>
</ol>
<p>Now that I write it all out, though, it seems pretty doable. I should probably write more stuff out.</p>
<p>Flaws in the plan? Mostly that it&rsquo;s going to add some load time as each page is pulled in, dissected, and checksummed. Fortunately, there are advanced GIF technologies to make that seem almost pleasant:</p>
<p><a href="https://media.puddingtime.org/archive/mph.puddingbowl.org/wordpress/wp-content/uploads/2015/03/712.gif" class="glightbox" data-gallery="post-16786cb0d1adff13f895fb2065a51042"><img src="https://media.puddingtime.org/archive/mph.puddingbowl.org/wordpress/wp-content/uploads/2015/03/712.gif" alt="" loading="lazy"></a></p>
<p>It&rsquo;s something I could do at import time, too, I guess. There&rsquo;s nothing sacred about the underlying markup.</p>
<p>Oh, the other problem is &ldquo;what about when that element changes, even if it&rsquo;s for the better?&rdquo; At that point, the checksum changes and the flag/comment history disappears because it becomes a &ldquo;new&rdquo; element. There goes the inventory. Which means the inventory might become something less about the literal content and more about what/where it is, e.g. &ldquo;ordered list on page {foo} under the heading {bar}.&rdquo; So when a flag gets thrown on an element, the existence and &ldquo;coordinates&rdquo; of the thing are logged somewhere, along with a snapshot of what it looked like at the time. That&rsquo;s probably going to be enough to find it again.</p>
<p>Hm.</p>
<p>So we could go either way here. I think writing the checksumming service and coding up the process sounds interesting and fun. I think deciding that flagging elements and leaving comments on them as a one-time process with no expectation of permanence might be okay. I think automating a log based on &ldquo;there&rsquo;s a fishy set of instructions on the page called {foo} under the heading {bar}&rdquo; sounds like a useful middle ground. I&rsquo;ve also already figured out the xpath needed to do just that: &ldquo;Show me a thing plus the most recent heading that occurred before it,&rdquo; which has proven great for explaining what some of the lists and pre blocks are trying to tell you at a glance.</p>
<p>Well &hellip; something to think about.</p>
<p>#docs_decomposer #rails</p>
<p><em><a href="mailto:mike@puddingtime.org?subject=Re%3A%20Docs%20Decomposer%20%234">Drop a line about this</a>.</em></p>]]></content:encoded>
    </item>
    <item>
      <title>Docs Decomposer Weekend 3</title>
      <link>https://mike.puddingtime.org/posts/2015-03-09-docs-decomposer-weekend-3/</link>
      <pubDate>Mon, 09 Mar 2015 09:28:27 +0000</pubDate><author>mike@puddingtime.org (mike)</author>
      <guid>https://mike.puddingtime.org/posts/2015-03-09-docs-decomposer-weekend-3/</guid>
      
      <description>Okay!
I added a Comment model to the project this weekend, then wired it up to a modal form. Useful things I learned to use this weekend:
simple_form, which makes it a little easier to write forms in Rails, and which understands Bootstrap. markdownizer, which can take a text column and render it to …</description>
      <content:encoded><![CDATA[<p>Okay!</p>
<p>I added a Comment model to the project this weekend, then wired it up to a modal form. Useful things I learned to use this weekend:</p>
<ul>
<li><a href="https://github.com/plataformatec/simple_form">simple_form</a>, which makes it a little easier to write forms in Rails, and which understands Bootstrap.</li>
<li><a href="https://github.com/codegram/markdownizer">markdownizer</a>, which can take a text column and render it to Markdown on creation, which will help make the comments a little more expressive.</li>
</ul>
<p>And since I&rsquo;m using <code>twitter-bootstrap-rails</code>, I got some handy freebies for styling the flash with Bootstrap text styles.</p>
<p>A few things I didn&rsquo;t get to:</p>
<ul>
<li>
<p>Making it possible for users to delete their own comments.</p>
</li>
<li>
<p>Making it possible for users to edit their own comments.<br>
<em>In other words, the comments feature sort of sucks, but at least you can suffer in Markdown.</em></p>
</li>
<li>
<p>Connecting the act of flagging to invoking the comments form.</p>
</li>
</ul>
<p>And to replace the spreadsheet we came up with to review the upstream platform docs last week, I probably need to add a tags field of some kind. I think that&rsquo;s a <a href="https://github.com/mbleigh/acts-as-taggable-on">solved problem</a>.</p>
<p>One more weekend?</p>
<p><a href="https://media.puddingtime.org/archive/mph.puddingbowl.org/wordpress/wp-content/uploads/2015/03/Docs_Decomposer.png" class="glightbox" data-gallery="post-817d2a63b0559125868511d2ac976f37"><img src="https://media.puddingtime.org/archive/mph.puddingbowl.org/wordpress/wp-content/uploads/2015/03/Docs_Decomposer.png" alt="" loading="lazy"></a></p>
<p><a href="https://media.puddingtime.org/archive/mph.puddingbowl.org/wordpress/wp-content/uploads/2015/03/Menubar_and_Docs_Decomposer_and_CSS_%c2%b7_Bootstrap.jpg" class="glightbox" data-gallery="post-817d2a63b0559125868511d2ac976f37"><img src="https://media.puddingtime.org/archive/mph.puddingbowl.org/wordpress/wp-content/uploads/2015/03/Menubar_and_Docs_Decomposer_and_CSS_%c2%b7_Bootstrap.jpg" alt="" loading="lazy"></a></p>
<p>#docs_decomposer #rails</p>
<p><em><a href="mailto:mike@puddingtime.org?subject=Re%3A%20Docs%20Decomposer%20Weekend%203">Drop a line about this</a>.</em></p>]]></content:encoded>
    </item>
    <item>
      <title>Docs Decomposer Weekend 2</title>
      <link>https://mike.puddingtime.org/posts/2015-02-23-docs-decomposer-weekend-2/</link>
      <pubDate>Mon, 23 Feb 2015 15:31:01 +0000</pubDate><author>mike@puddingtime.org (mike)</author>
      <guid>https://mike.puddingtime.org/posts/2015-02-23-docs-decomposer-weekend-2/</guid>
      
      <description>Last week I left off with a gnawing sense of unhappiness because the flagging buttons weren’t dynamic: When Rails dropped Prototype.js, it dropped pretty much all the stuff I knew about AJAX and Rails. I could have left well enough alone, but it bothered me; and we’re doing this in the name of …</description>
      <content:encoded><![CDATA[<p><a href="/2015/02/weekend-science-project-rails-after-time-away/">Last week I left off</a> with a gnawing sense of unhappiness because the flagging buttons weren&rsquo;t dynamic: When Rails dropped Prototype.js, it dropped pretty much all the stuff I knew about AJAX and Rails. I could have left well enough alone, but it bothered me; and we&rsquo;re doing this in the name of (re)learning.</p>
<p>I had fun working on it. Last weekend&rsquo;s time involved a lot of re-orientation on the basics. This week felt pretty fluid as stuff I&rsquo;d forgotten came back, and as I got used to a few of the tweaks I added to Emacs last week (including <a href="http://www.gnu.org/software/emacs/manual/html_mono/flymake.html">flymake</a> and <a href="https://github.com/bbatsov/projectile">Projectile</a>).</p>
<p>In the process of rewriting the flagging code into something a little easier to work with, I learned about  <a href="https://github.com/ryanto/acts_as_votable">acts_as_votable</a>, and that encouraged me to just toss the flagging code I&rsquo;d written altogether. Yay, cargo culting. That didn&rsquo;t make the dynamic flagging button situation any better, but it did make a few other features fall down much more quickly.</p>
<p>So this weekend I added:</p>
<ul>
<li>Flag status indicators to the page lists. You can tell if you&rsquo;re the one who flagged the page, and if someone else also flagged it along with</li>
<li>A toggle to hide all the unflagged pages</li>
<li>A little list of who flagged a page on the page itself, along with next/previous buttons for each page, to make it easier to run through review without going back and forth to the master page list:</li>
</ul>
<div style="text-align:center;">
<a href="http://mph.puddingbowl.org/wordpress/wp-content/uploads/2015/02/docs_decomposer_buttons2.jpg">
![](https://media.puddingtime.org/archive/mph.puddingbowl.org/wordpress/wp-content/uploads/2015/02/docs_decomposer_buttons_sm.jpg)<br />Click for a larger version</a>
</div>
<p>Next up, I guess, is commenting. I was hoping to get to it this weekend, but once I had acts_as_votable in place, it was a lot easier to run through a bunch of flag-related things and implement them, and I was ready for some easy stuff once I&rsquo;d finally managed to make the flagging buttons dynamic.</p>
<p>Once I&rsquo;ve got commenting in place, it&rsquo;ll be time to go back through and do a lot of housekeeping. I&rsquo;ve got view code that probably ought to go into partials, controllers that could probably stand to have some logic moved out into the models, and a lot of code that &hellip; well &hellip; it&rsquo;s optimistic is what it is!</p>
<p>After that?</p>
<p>The thing I keep thinking about and sketching out is how being able to flag a given element on a page might work. One of the reasons I decided to just import HTML straight into the app was that it gave me access to the markup. For instance, once you find and checksum an ordered list, it&rsquo;s pretty easy to wrap it in a div and give it an i.d. At that point, it can be targeted for flagging widgets and such.</p>
<p>Dunno. Bedtime.</p>
<p>#docs_decomposer #rails</p>
<p><em><a href="mailto:mike@puddingtime.org?subject=Re%3A%20Docs%20Decomposer%20Weekend%202">Drop a line about this</a>.</em></p>]]></content:encoded>
    </item>
    <item>
      <title>Weekend Science Project (Rails After Time Away)
![](https://media.puddingtime.org/archive/mph.puddingbowl.org/wordpress/wp-content/uploads/2015/02/decomposer_t.jpg)
Showing all…</title>
      <link>https://mike.puddingtime.org/posts/2015-02-17-weekend-science-project-rails-after-time-away/</link>
      <pubDate>Tue, 17 Feb 2015 15:06:45 +0000</pubDate><author>mike@puddingtime.org (mike)</author>
      <guid>https://mike.puddingtime.org/posts/2015-02-17-weekend-science-project-rails-after-time-away/</guid>
      
      <description>Weekend Science Project (Rails After Time Away)
![](https://media.puddingtime.org/archive/mph.puddingbowl.org/wordpress/wp-content/uploads/2015/02/decomposer_t.jpg)
Showing all the content Click for a larger version
We need to do a documentation inventory at work. We’ve added a lot to the docs over …</description>
      <content:encoded><![CDATA[<p>Weekend Science Project (Rails After Time Away)</p>
<div style="float:right; text-align:center;">
<a href="https://www.evernote.com/shard/s3/sh/545fab72-8a9f-4ba3-93b3-a2b4f21a3b96/f929c2f8dd2c9df6d66887abb807b4f9/deep/0/Docs-Decomposer.png">
![](https://media.puddingtime.org/archive/mph.puddingbowl.org/wordpress/wp-content/uploads/2015/02/decomposer_t.jpg)<br />Showing all the content <br />Click for a larger version</a></a><br />
</div>
<p>We need to do a documentation inventory at work. We&rsquo;ve added a lot to the docs over the past year, and we&rsquo;ve got a few things lurking around in there that need to be flagged for QA or revalidation. The stock answer is &ldquo;put all the pages in a spreadsheet and start clicking/scrolling and annotating the list,&rdquo; but I&rsquo;ve been pining to fiddle around with a tool for a little while, and spreadsheets suck, so I decided to see how quickly I could put something together to make the job a little easier for the team (and reviewers down the road).</p>
<p>I started out with a <a href="http://padrinorb.com">Padrino</a> app, which was a great way to do a proof of concept on what I was after:</p>
<ul>
<li>Find all the Markdown files in the docs repo.</li>
<li>Use the filenames to compose the live URLs of each document.</li>
<li>Pull the HTML in from the server and store it for fast retrieval/decomposition</li>
<li>Identify all the elements of interest on each page and store them with a checksum.</li>
</ul>
<p>For that last, &ldquo;elements of interest&rdquo; became &ldquo;ordered lists and things inside pre tags.&rdquo; They represent the step-by-step instructions in the docs; either in &ldquo;do this, then this, then this&rdquo; form, or in &ldquo;start typing this stuff on the command line&rdquo; form. They&rsquo;re the things people gravitate to and start following, and we know that the average technical user is prone to looking for just those things and not looking at the surrounding text.</p>
<p>Putting a checksum on each of them will provide a way to do reports that show when an element appears on multiple pages, and across multiple versions of the docs. You kind of expect things like ordered lists to change a little over time. If one has persisted over four or five releases without changing, you might want to look at it and make sure it hasn&rsquo;t been overlooked.</p>
<p>So after four or so hours of work, my Padrino app could do all that stuff, wrapped up in Bootstrap.
I could fire up the app, get a list of all the documentation pages by product version, and use some widgets to do a few useful things:</p>
<ul>
<li>See all the elements of interest in their own tab.</li>
<li>Preview a docs page, then click a button to show only the headings, pre blocks, and ordered lists.</li>
</ul>
<p>That seemed pretty useful just as a way to help someone rip through a collection of pages and look for just the things most likely to cause a user pain, then maybe enter them in a log.</p>
<p>Once I was home for the weekend, though, I realized that I wasn&rsquo;t as familiar with Padrino as I once had been with Rails, so I decided to do a quick port. Since I&rsquo;d used ActiveRecord for the original app, and since I was happy with my db schema, it was pretty simple to set up the models, re-run the migrations, and reuse the importer scripts to repopulate my development db with content.</p>
<p>I spent a few hours on Saturday and a big chunk of Sunday trying to see how far I could get before, well, having enough time to blog about it before ending the long weekend and going to bed. I didn&rsquo;t want to put any more time in on it at work, because if I ran into a dead end and couldn&rsquo;t make what I wanted, I didn&rsquo;t want to feel obligated to try using it.</p>
<div style="float:right; text-align:center;">
<a href="https://www.evernote.com/shard/s3/sh/bb9cb8a4-6d28-4529-ab31-666672a6e6f5/7b8c3859e28955330e9b0c0d326a1d7c/deep/0/Docs-Decomposer.png">
![](https://media.puddingtime.org/archive/mph.puddingbowl.org/wordpress/wp-content/uploads/2015/02/Docs_Decomposer3t.jpg)<br />Showing just headings, pre, and ol elements. <br />Click for a larger version</a></a><br />
</div>
<p>I had to relearn a few things about Rails that have changed since I last used it much (during v2 times), and I had to learn some new things about jQuery that I&rsquo;ve never dealt with before. Still, I&rsquo;m pretty happy with where it&rsquo;s at now:</p>
<p>First, I implemented flags.  For now, all you can do is flag a page if you see something you think might be a problem that needs further review. I&rsquo;ve got a few ideas about how to flag individual elements. One way is super simple, but doesn&rsquo;t allow you to flag them in the context of the text. The other is tougher and I&rsquo;m still working on relearning Rails&rsquo; AJAXy stuff to figure out a way to flag an element in place, store it, then have it highlighted as flagged next time you visit that page.</p>
<p>Next, I added a working user authentication model with <a href="https://github.com/plataformatec/devise">Devise</a>, so flags can belong to individual people. For now, it just means that if two people look at the same page, they don&rsquo;t have to agree on its flaggability. Down the road, it&rsquo;ll mean there&rsquo;s a way to share the tool with all our technical reviewers so that they can flag things and we can capture all the flag data from them. I&rsquo;d like to add a way to enter a comment, too, but one thing at a time.</p>
<p>Finally, I got thiiiiis close to making the flag button truly dynamic. All the AJAX stuff I knew from when I built my last Rails app has changed, and I couldn&rsquo;t figure it all out in time, so for now I just force a page refresh when the user clicks the flag button to get it to change its state from &ldquo;flag this&rdquo; to &ldquo;unflag this.&rdquo;</p>
<p>There are a few more things I&rsquo;d like to get to:</p>
<ul>
<li>Report pages, naturally: Every flagged page, how many flags it has. That won&rsquo;t take much.</li>
<li>Flaggable elements (ol, pre): I can already do this the easy way, but I&rsquo;d love to do it the hard way.</li>
<li>Comments to go with flags, with design to accommodate a running list of flag comments down the side of a page preview.</li>
<li>Dynamic page import. Right now, we get the map of all the files then suck in their HTML and store it. The advantage is that it&rsquo;s pretty fast. The disadvantage is that the content will drift from reality over the course of a release cycle. Way better to either suck it in each time the page is viewed or offer a &ldquo;re-import the HTML&rdquo; button people can hit.</li>
<li>Links straight to the files in the Github repo, so people can quickly fix things from the app if they spot something.</li>
</ul>
<p>It&rsquo;s in a place where I knock most of that stuff off with another leisure-time sprint, then see about hosting it somewhere relatively secure where I can put it in front of a few people for real feedback.</p>
<p>It also reminds me of all the stuff I wish I knew more about, like testing. I guess if I can get it into a useable state for other people, I can use it as a sandbox for learning about that stuff.</p>
<p>Anyhow, <a href="https://github.com/pdxmph/docs_decomposer">here it is</a>. Hope you had a good Presidents Day weekend. Good night.</p>
<p>#docs_decomposer #rails #ruby #work</p>
<p><em><a href="mailto:mike@puddingtime.org?subject=Re%3A%20Weekend%20Science%20Project%20%28Rails%20After%20Time%20Away%29%0A%21%5B%5D%28https%3A%2F%2Fmedia.puddingtime.org%2Farchive%2Fmph.puddingbowl.org%2Fwordpress%2Fwp-content%2Fuploads%2F2015%2F02%2Fdecomposer_t.jpg%29%0AShowing%20all%E2%80%A6">Drop a line about this</a>.</em></p>]]></content:encoded>
    </item>
  </channel>
</rss>
