質問はTwitterへ #RESTudy をつけてどうぞ。
10.6 リンク (p.168)
質問はTwitterへ #RESTudy をつけてどうぞ。
10.6 リンク (p.168)
# config/initializers/i18n_exception_handler.rb | |
I18n.exception_handler = ->(exception, locale, key, options) do | |
if exception.is_a?(I18n::MissingTranslation) | |
Rails.logger.warn exception.message if Rails.env.development? | |
key.to_s.split('.').last.humanize | |
else | |
raise exception | |
end | |
end |
module ApplicationHelper | |
def render_thumbsup_button(options) | |
options[:url] ||= thumbsup_path | |
options[:method] ||= :put | |
options[:count] ||= 0 | |
# ローカル変数を渡したいときのみ locals が必要 | |
render inline: <<-HAML.strip_heredoc, type: :haml, locals: options | |
.thumbsup | |
= form_tag url, method: method do | |
%button.btn.btn-xs |
# cf. | |
# http://nttpc.now.tl/ac2014/?p=20#toc_4 | |
# https://github.com/cookpad/styleguide/blob/master/ruby.ja.md | |
# https://gist.github.com/onk/38bfbd78899d892e0e83 | |
# https://github.com/onk/onkcop/blob/master/config/rubocop.yml | |
AllCops: | |
DisplayCopNames: true | |
Exclude: | |
- db/schema.rb |
env: | |
browser: true | |
extends: 'eslint:recommended' | |
rules: | |
# http://eslint.org/docs/rules/ | |
# ==================== | |
# Possible Errors | |
# ==================== |
module ApplicationHelper | |
def google_tag_manager_head | |
return unless Rails.env.production? | |
<<-HTML.html_safe | |
<!-- Google Tag Manager --> | |
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': | |
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], | |
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= | |
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); | |
})(window,document,'script','dataLayer','GTM-WHX4V4D');</script> |
質問はTwitterへ #RESTudy をつけてどうぞ。
第11章〜第13章は、考え方としては役立ちますが、現在ほとんど使われていない記述があるので、後回しにしてまず第14章から読んでいきましょう。14章を読み終わったら、グループで話し合って第11章〜第13章の興味のあるところに進んでもらってかまいません。
https://rubychildren.doorkeeper.jp/events/39034
質問はTwitterへ #RESTudy をつけてどうぞ。
「駅すぱあとWebサービス」を題材に、どこがRESTfulか、どうしたらRESTの規約に近づけるかなどグループで話し合いましょう。