こんにちは。gifteeの小澤です。 gifteeでは毎週月曜日に各エンジニア持ち回りでLTをやっています。 今回BASIC認証に関してのLTを発表したので、その際のスライドを公開します。 プロダクトをリリースするまでの間、BASIC認証を使用して一般公開から保護するケースは 比較的あるかと思います。 今回は、BASIC認証を使っていることを視覚的に判別したいという要求が生じたたため、 Railsでの解決方法についてスライドにまとめました。
郵便番号から住所情報を取得する方法 require 'jipcode'でjipcodeを適宜読み込んでください。 Jipcodeモジュールの.locate関数に郵便番号の文字列を渡すと、住所情報のHashを要素とする配列が返ります。 なぜ配列かというと、郵便番号は1個の番号につき複数の住所が結びつくことがあるためです。 住所情報のHashは郵便番号(:zipcode)、都道府県(:prefecture)、市区町村(:city)、町域番地(:town)のキー値を持ちます。 Jipcode.locate('1510051') # => [{zipcode: '1510051', prefecture: '東京都', city: '渋谷区', town: '千駄ヶ谷'}] # 該当する住所がない場合 Jipcode.locate('hoge') # => []
広告技術部の toshimaru です。この記事はGunosy Advent Calendarの24日目の記事です。 qiita.com はじめに Gunosyではいくつかの管理画面においてRuby on Rails(以降Rails)を利用しています。具体的には下記の管理画面においてRailsが利用されています。 社内メンバー向け管理画面: 社内の担当者が記事の管理を行ったり、Gunosyアプリのユーザーの管理を行ったりできる管理画面です メディア様向け管理画面: Gunosyに記事を提供していただいているメディア様向け管理画面で、レポート閲覧や記事管理を行うことができます 広告主様向け管理画面: Gunosy Adsに広告を配信していただいている広告様向けの管理画面で、広告出稿やレポート閲覧を行うことができます 今日はそんなGunosy管理画面を支えているRails技術をいくつかピックア
この記事はRuby on Rails Advent Calendar 2017 17日目の記事です。 はじめに 今回初めて ruby on railsのアドベントカレンダーに参加させていただきます。 稚拙な内容などはご了承ください。 また今回検証するためにソースコードを一部お借りさせていただきました。 Ruby on Rails Advent Calendar 2017 | 4日目 「先人達から学ぶRailsのテーブル設計」- kikunantoka 検証対象 OSS ekremkaraca/awesome-railsにあるレポジトリー92種類を対象としています。 注意事項 古いレポジトリーなども含まれているため、Gemの取り扱いの際はご自身で一度確認することをおすすめします。 方法 記事を参考にレポジトリーからGemfileを抽出し、データベースに保存。 各カテゴリー別に分けて使用されて
ども、@kimihom です。 すっかり年末感漂う感じになってきた。本ブログではそんなこと関係なく、引き続き API の話題。 前回のAPI 開発において認証以外で気をつけるべきこと で API 開発における検討事項を列挙した。その前の API 認証の設計も踏まえて、今回は実際に Ruby on Rails を事例に設計を始めていきたい。 選定した Gem 今回は Rails の API 開発でおなじみの Grape とその周辺 Gem を利用する。そもそも何故 Grape なのかというと、1つ目は REST API の書き方に特化している DSL (domain-specific language) であるため、簡単にAPI が作成できる点がある。実装の例は Grape の Github を閲覧してみていただきたい。2つ目に、APIの開発に特化しているため、余計な Rails の mid
Grape は RESTful な API を構築するためのマイクロフレームワークです。 今回は Grape を使って簡単な Web API を作っていきます。 intridea/grape · GitHub [2015/03/07] ファイルの配置を変更しました。変更点は GitHub をご確認ください。 準備 $ rails g model MessageBoard title:string body:text $ rails g model Comment message_board_id:integer body:text $ rake db:migrate $ rails g rspec:install # app/models/message_board.rb class MessageBoard < ActiveRecord::Base has_many :comments
Ruby Advent Calendar 11日目 Ruby - Rails開発で有用な便利Gem一覧:2013年版 - Qiita ↑去年のAdventCalendarで書いた上記の記事の2014年版です。 だんだん毎年恒例的になって来ました。 最近はデファクトスタンダードがほぼ固まってきて、かなり毎回使うGemのリストが固定化して来ました。 ※2014/12/11時点 DBアダプタ sqlite3 pg mysql2 この辺りはもう変わらないですね。 RubyやRailsのバージョンが上がっても継続的に開発が続けられているのは素晴らしいと思います。 ログイン認証 omniauth omniauth-twitter omniauth-facebook omniauth-github omniauth-identity (omniauth-githubのリポジトリのURLが変わってました。
本記事は少しのコードでWebPayを導入する – Qiitaの再録です。 Qiitaの方はWebPay Advent Calendar 2013のものであるため当時の状態を維持し こちらの記事では最新の情報に合わせて加筆、編集を加えております。 決済のコードを出来るだけ少なく ウェブサービスのコードの中で決済に関わる部分に対する開発者の不安を拭うことはとても難しいです。ソフトウェアとして動くというのは勿論、ビジネス上の条件との整合性や 決済に限った話ではないですが、お金を払うお客さんという登場人物が増えるだけで「何か問題があったら…」と膨らむ緊張感は小さくありません。 テストを書くとかプライシングの責任者とのコミュニケーションを密にとか大事なことはいくらでもあるのですが、その中に「決済にまつわるコードを少なくする」というのもあっても良いかもしれません。シンプルで短いコードで無為なミスや変な
Rails4.1が正式にリリースされたらしいので少し見てみたけど、secrets.ymlとかいうのがサポートされるようになったんですね。 公開したくないAPIキーなどの情報をconfig/secrets.ymlに書いておくとRails内でアクセスできるのだとか。 こうやって書いておくと # config/secrets.yml development: secret_key_base: cfcc784a39.... hoge_api_key: hogehogehoge こう呼べる。 Rails.application.secrets.hoge_api_key で、このsecrets.ymlをソース管理から外しておけばその他は公開できるよね、みたいな。他のサービスと連携するオープンソースなRailsアプリにするときなんかに使えばいいんだと思います。 Figaroと一緒では 同じことをするため
昨日、RailsでOmniauthを使ってTwitterログインする方法をまとめました。 今回はログイン後に定型文をつぶやいたり、特定アカウントをフォローできるようにしたいと思います。 詳細記事はこちらをご参照ください 初期設定 Gemfile記述 [注意書き] 先日の記事でご紹介したtweetstream gemでStreamingAPIも一緒に使用したい場合、twitter gemの最新バージョン(version 5)だとエラーになってしまうので4.8以上5未満を使用するようにGemfileを修正しました。 tweetstreamを使用しない場合は最新のtwitter gemを使用して問題ないと思います。 今回はtwitter gemバージョン4.8を使用したやり方を書いていますが、バージョン5以降は初期化処理のパラメータ名等が変わっているので注意が必要です。 詳しくはtwitter
Ruby on Rails Advent Calendar 12日目。 Rails開発で有用な便利Gem一覧 - Qiita [キータ] ↑去年のAdventCalendarで書いた上記の記事の2013年版です。 去年と比べるとRails3系で使っていたGemが順当にRails4に対応して、継続して使っている印象です。 ※2013/12/12時点 DBアダプタ sqlite3 pg mysql2 定番。Rails4になってもおなじみ。 ログイン認証 omniauth omniauth-twitter omniauth-facebook omniauth-github omniauth-identity ↓自作したomniauth用のscaffoldを作るGemに組み込んで使っています。 shu0115/minimum-omniauth-scaffold 定数/設定値管理 rails_con
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く