{"id":561,"date":"2014-04-17T02:16:56","date_gmt":"2014-04-17T06:16:56","guid":{"rendered":"http:\/\/michaelseneadza.com\/blog\/?p=561"},"modified":"2014-04-17T02:16:56","modified_gmt":"2014-04-17T06:16:56","slug":"ruby-rails-memoization-gems-memoist-vs-memoizable","status":"publish","type":"post","link":"http:\/\/www.michaelseneadza.com\/blog\/2014\/04\/17\/ruby-rails-memoization-gems-memoist-vs-memoizable\/","title":{"rendered":"Ruby \/ Rails Memoization Gems Memoist vs. Memoizable"},"content":{"rendered":"<p>I was just adding some memoization to a Rails app and I was exploring the available gems.  I&#8217;d used <a href=\"https:\/\/github.com\/matthewrudy\/memoist\">Memoist<\/a> in the past on another project but I couldn&#8217;t remember why I chose it over other gems.  <\/p>\n<p>While researching today I found the <a href=\"https:\/\/github.com\/dkubb\/memoizable\">Memoizable<\/a> gem and thought that it looked pretty good.  It has all these nice badges on the GitHub page, like a CodeClimate score of 4.0.  So I figured I&#8217;d go with Memoizable.<\/p>\n<p>After installing it and memoizing some methods I realized why I went with Memoist in the past.  Memoizable won&#8217;t let you memoize methods that take parameters.  If you try to do so it will complain loudly with &#8220;Cannot memoize Class#method_name, its arity is 1&#8221;.<\/p>\n<p>That was a non-starter for me.  I switched to Memoist and all is well.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was just adding some memoization to a Rails app and I was exploring the available gems. I&#8217;d used Memoist in the past on another project but I couldn&#8217;t remember why I chose it over other gems. While researching today I found the Memoizable gem and thought that it looked pretty good. It has all&hellip; <a class=\"more-link\" href=\"http:\/\/www.michaelseneadza.com\/blog\/2014\/04\/17\/ruby-rails-memoization-gems-memoist-vs-memoizable\/\">Continue reading <span class=\"screen-reader-text\">Ruby \/ Rails Memoization Gems Memoist vs. Memoizable<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","footnotes":""},"categories":[16],"tags":[],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":566,"url":"http:\/\/www.michaelseneadza.com\/blog\/2014\/05\/02\/calculating-standard-deviations-in-ruby-on-rails-and-postgresql\/","url_meta":{"origin":561,"position":0},"title":"Calculating Standard Deviations in Ruby on Rails (and PostgreSQL)","date":"May 2, 2014","format":false,"excerpt":"I need to calculate some Bollinger Bands (BBs) for SwingTradeBot, which is built in Rails 4. Here's a quick definition of Bollinger Bands: Bollinger Bands\u00ae are volatility bands placed above and below a moving average. Volatility is based on the standard deviation, which changes as volatility increases and decreases. So\u2026","rel":"","context":"In &quot;Technology&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":557,"url":"http:\/\/www.michaelseneadza.com\/blog\/2014\/04\/06\/ive-finally-found-a-rails-4-x-blogging-engine-gem\/","url_meta":{"origin":561,"position":1},"title":"I&#8217;ve Finally Found a Rails 4.x Blogging Engine \/ Gem","date":"April 6, 2014","format":false,"excerpt":"I can't believe how difficult it's been to find a good solution for plugging a simple blog into an existing Rails app. I wanted to add a blog to SwingTradeBot, the new site I'm building but most answers to this question that I've found say to either use RefineryCMS or\u2026","rel":"","context":"In &quot;Blogging&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":574,"url":"http:\/\/www.michaelseneadza.com\/blog\/2014\/08\/06\/slow-responses-from-the-braintree-ruby-gem-try-this-fix\/","url_meta":{"origin":561,"position":2},"title":"Slow Responses from the BrainTree Ruby Gem? Try This Fix.","date":"August 6, 2014","format":false,"excerpt":"A few weeks ago I was tasked with trying to mitigate some timeout issues in a client's Rails app making BrainTree calls. This was becoming more of a problem as the client's users built up more & more history in BrainTree. Apparently you can't paginate the results or ask BrainTree\u2026","rel":"","context":"In &quot;Technology&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":830,"url":"http:\/\/www.michaelseneadza.com\/blog\/2021\/12\/20\/rails-7s-load_async-doesnt-play-well-with-multi-tenant-apps\/","url_meta":{"origin":561,"position":3},"title":"Rails 7&#8217;s load_async Doesn&#8217;t Play Well with Multi-Tenant Apps","date":"December 20, 2021","format":false,"excerpt":"Disclaimer: I can't speak for all multi-tenant apps but I suspect the vast majority of those which use separate DB schemas will run into the same issue I ran into. I was excited to try out the new Relation#load_async feature in Rails 7 to speed up some pages on SwingTradeBot.\u2026","rel":"","context":"In &quot;Technology&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":189,"url":"http:\/\/www.michaelseneadza.com\/blog\/2003\/09\/16\/why_people_dont_vote\/","url_meta":{"origin":561,"position":4},"title":"Why People Don&#8217;t Vote","date":"September 16, 2003","format":false,"excerpt":"Dave does it again... This time breaking down the reasons people give for not voting, complete with Tipping Points. (And he gives a great comparison to the reasons that people give for not exercising.) I used to be guilty of using reasons 1 through 6 as rationalization not to vote.\u2026","rel":"","context":"In &quot;Current Events&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":179,"url":"http:\/\/www.michaelseneadza.com\/blog\/2003\/09\/05\/more_on_comment_spam\/","url_meta":{"origin":561,"position":5},"title":"More on Comment Spam","date":"September 5, 2003","format":false,"excerpt":"There's a discussion about possible methods of stopping blog comments spamming over at Adam Kalsey's blog. Go add your thoughts.","rel":"","context":"In &quot;Blogging&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/www.michaelseneadza.com\/blog\/wp-json\/wp\/v2\/posts\/561"}],"collection":[{"href":"http:\/\/www.michaelseneadza.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.michaelseneadza.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.michaelseneadza.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.michaelseneadza.com\/blog\/wp-json\/wp\/v2\/comments?post=561"}],"version-history":[{"count":0,"href":"http:\/\/www.michaelseneadza.com\/blog\/wp-json\/wp\/v2\/posts\/561\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.michaelseneadza.com\/blog\/wp-json\/wp\/v2\/media?parent=561"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.michaelseneadza.com\/blog\/wp-json\/wp\/v2\/categories?post=561"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.michaelseneadza.com\/blog\/wp-json\/wp\/v2\/tags?post=561"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}