サクサク読めて、アプリ限定の機能も多数!
トップへ戻る
ドラクエ3
thepugautomatic.com
Struct inheritance is overusedWritten August 8, 2013. Tagged Ruby. Too many people inherit from Struct.new(:some, :attributes) as a shorthand without understanding the implications. Take this for example: class Greeter < Struct.new(:person) def greet puts "Hello, #{person.name}!" end endSure, it's convenient. It saves you writing an initializer. But that's not all it does. Struct arguments are not
Understanding Elixir macrosWritten October 31, 2015. Tagged Elixir, Macros. Elixir macros are conceptually quite simple, though they can be daunting when you're starting out. It took me plenty of flailing about to get a clear mental model of how they work, and plenty of experimentation. I thought I'd write up some of my insights, in case they help others get there sooner. This is not a "write your
What I dislike about DraperWritten March 1, 2014. Tagged Ruby on Rails, Presenters. My team used Draper a few years back ago and its design inspired us to make poor decisions that we've come to regret. If you want presenters in Rails (or "view models", or "decorators" as Draper calls them), just use a plain old Ruby object. Pass in the view context when you need it. Don't decorate. Don't delegate
The risks of feature branches and pre-merge code reviewWritten February 12, 2014. Tagged Git, Code review, Continuous Delivery. Our team has been doing only spontaneous code review for a good while – on commits in the master branch that happen to pique one's interest. This week, we started systematically reviewing all non-trivial features, as an experiment, but this is still after it's pushed to m
Rails STI and form_forWritten August 14, 2012. Tagged Ruby on Rails, STI. Rails' form_for conveniently uses "record identification" to figure out the correct URL based on the model: = form_for([:admin, @item]) do |f| = f.text_field :nameIt's also used to figure out the HTTP verb, the field name prefixes, HTML classes and HTML id. So this form would POST to admin_items_path for a new record, or PUT
Rails i18n tipsWritten July 22, 2012. Tagged Ruby on Rails, i18n, Tips. These are some tips based on my experiences of working with Rails i18n, extracted from my styleguide. Avoid translated view filesIf you ever need to work with external translators, it's a bit of a pain sending both your YML files and a bunch of views like index.en.html.erb. For one thing, you need some code to find all those f
このページを最初にブックマークしてみませんか?
『thepugautomatic.com』の新着エントリーを見る
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く