おすすめ gem

おすすめ gem

Slideshare (http://www.slideshare.net/chocoby/gem-13022540) にアップロードしていたものですが、Speaker Deck にアップロードしてみました。
社内の LT で発表したものです。

37d7ffd14a3d1af0627fcb48e09f0c9a?s=128

Kenta Okamoto

July 02, 2012
Tweet

Transcript

  1. ͓͢͢ΊHFNͷ঺հ !DIP@DP ։ൃ-5

  2. HFNͱ͸ʁ w 3VCZͷϥΠϒϥϦΛύοέʔδԽ͠ ͨ΋ͷ w 1)1Ͱ͍͏QFBSΈ͍ͨͳ΋ͷ w ύοέʔδ؅ཧγεςϜࣗମ͸ 3VCZ(FNTͱݺͿ

  3. Πϯετʔϧ $ gem install rails

  4. ݕࡧ $ gem search -r mysql

  5. *** REMOTE GEMS *** activerecord-jdbcmysql-adapter (1.2.2, 1.0.3 java) activerecord-mysql-adapter-flags (0.0.3)

    activerecord-mysql2-retry-ext (0.1.0) activerecord-mysql2legacydb-adapter (0.2.0) activerecord-mysql2spatial-adapter (0.4.2) activerecord-mysqlspatial-adapter (0.4.1) airblade-mysql_s3_backup (0.0.4) aqueduct-mysql (0.1.0) capistrano-mysqldump (1.06) create_rails_mysql_db (0.2.3) ...
  6. ϩʔΧϧHFNҰཡ $ gem list

  7. *** LOCAL GEMS *** abstract (1.0.0) actionmailer (3.2.1) actionpack (3.2.1)

    activemodel (3.2.1) activerecord (3.2.1) activeresource (3.2.1) activesupport (3.2.1) addressable (2.2.8) arel (3.0.0) awesome_print (1.0.2) ...
  8. SVCZHFNTPSH

  9. SVCZHFNTPSHͱ͸ʁ w IUUQSVCZHFNTPSH w HFNͷϗεςΟϯάαʔϏε w 1)1Ͱ͍͏QFBSΈ͍ͨͳ΋ͷ w  HFNT

    w  VTFST w HFNJOTUBMM͸σϑΥϧτͰSVCZHFNTΛݟʹߦ͘
  10. CVOEMFS w SVCZHFNTΑΓ্ҐϨΠϠʔͷύοέʔδ؅ ཧγεςϜ w ඞཁͱͳΔHFNΛ(FNpMFʹॻ͍͓ͯ͘

  11. # Gemfile source 'https://rubygems.org' gem 'rails’ gem 'mysql2' ...

  12. Πϯετʔϧ # Gemfile ʹهड़͞Εͨ gem ΛΠϯετʔϧ͢Δ $ bundle install

  13. Կ͕͍͍ͷʁ w ͋ͷHFN͸։ൃ؀ڥʹ͸ೖ͍ͬͯΔ͚Ͳɺ ຊ൪؀ڥʹೖ͍ͬͯͳ͍ͷͰΞϓϦ͕ಈ͔ͳ ͍ʂͱ͍͏໰୊ΛղফͰ͖Δ w Πϯετʔϧ͢ΔόʔδϣϯΛݻఆͰ͖Δ w HFNؒͷґଘؔ܎Λղܾͯ͘͠ΕΔ

  14. ཁ͸ɺ#VOEMFS͸؀ڥຖ ͷࠩҟΛͳͯ͘͘͠ΕΔ ΠΧͨ͠Ϡπ

  15. ͓͢͢ΊHFNT w DVSSZCV΍ࠓ΍͍ͬͯΔϓϩδΣΫτ Ͱ࢖༻͍ͯ͠Δओʹ3BJMT޲͚ͷHFN w ͔͜͜Β͕ຊ୊ͳ͸ͣͳͷͰ͕࣌ؒ͢ ͕ͳ͍ͷͰۦ͚଍Ͱ͍͖·͢

  16. ೝূपΓ

  17. %FWJTF

  18. w ଟػೳͳೝূ༻ϥΠϒϥϦ w 0NOJ"VUIͱ૊Έ߹ΘͤΔ͜ͱͰ 'BDFCPPL΍5XJUUFSͳͲͱ0"VUIೝ ূ͢Δ͜ͱ͕Ͱ͖Δ w ͪΐͬͱن໛͕େ͖͍ؾ΋͢Δ w IUUQTHJUIVCDPNQMBUBGPSNBUFD

  19. %BUBCBTF"VUIFOUJDBUBCMF w Ұൠతͳ ೝূΛͯ͘͠ΕΔ w 3&45GVMͳ63-ϧʔςΟϯάΛੜ੒

  20. 3FHJTUFSBCMF w Ϣʔβʔొ࿥ɺฤू w %BUBCBTF"VUIFOUJDBUBCMFͱ૊Έ߹ Θͤͯ࢖༻

  21. 3FNFNCFSBCMF w ϩάΠϯঢ়ଶΛอ࣋

  22. $POpSNBCMF w Ϣʔβʔొ࿥ˠૹ৴͞Εͨϝʔϧͷ 63-Λ౿ΜͰ΋Βͬͯొ࿥׬ྃ

  23. 3FDPWFSBCMF w ύεϫʔυΛ๨Ε·͔ͨ͠ʁˠૹ৴͞ ΕͨϝʔϧʹΑͬͯύεϫʔυΛϦ ηοτ

  24. $BO$BO

  25. $BO$BO

  26. "OF$BO

  27. 4IJ#B

  28. w ݖݶपΓΛ৭ʑ΍ͬͯ͘ΕΔ w ؅ཧऀϢʔβʔͷಛݖͱ͔ w ʮ͜ͷ౤ߘΛ࡞੒ͨ͠ϢʔβʔͷΈ࡟আ͕Ͱ͖ Δʯͱ͍ͬͨνΣοΫΛεϚʔτʹߦ͑Δ w ೝূ͸୲౰֎ͳͷͰ%FWJTFͳͲͱซ༻͢Δඞཁ ͕͋Δ

    w IUUQTHJUIVCDPNSZBOCDBODBO
  29. # app/models/ability.rb class Ability include CanCan::Ability def initialize(user) user ||=

    User.new can :destroy, Post, user_id: user.id end end # app/controllers/posts_controller.rb class PostsController < ApplicationController before_filter :authenticate_user! load_and_authorize_resource # app/views/posts/edit.erb <% if can? :destroy, @user %> <%= link_to '࡟আ', posts, method: :delete %> <% end %>
  30. σʔλϕʔεपΓ

  31. FOVN@DPMVNO

  32. w NJHSBUJPOͰFOVNܕΛ࢖༻Մೳʹ w ͜ΕΛ࢖Θͳͯ͘΋ແཧ΍Γॻ͚Δ͕ɺ TDIFNBSC͕WBSDIBS  ͱ͔ʹͳΔͷ ͰΑΖ͘͠ͳ͍ w IUUQTHJUIVCDPNFMFDUSPOJDL

    FOVN@DPMVNO
  33. GPSFJHOFS

  34. w NJHSBUFϑΝΠϧʹ؆୯ʹ֎෦Ωʔ੍໿Λه ड़ w BEE@GPSFJHO@LFZ DPNNFOUT QPTUT w FYFDVUFϝιουΛ࢖༻͢Ε͹42-Ͱ΋ॻ ͚Δ͕ͪ͜Βͷ΄͏ָ͕

    w IUUQTHJUIVCDPNNBUUIVIJHHJOT GPSFJHOFS
  35. SBJMT@BDUT@BT@QBSBOPJE

  36. w ࿦ཧ࡟আ w ΧϥϜʹEFMFUFE@BUΛ௥Ճ͠ɺϞσϧʹ BDUT@BT@QBSBOPJEͱॻ͚ͩ͘ w IUUQTHJUIVCDPNHPODBMPTTJMWB SBJMT@BDUT@BT@QBSBOPJE

  37. ςετपΓ

  38. 34QFD

  39. w 5FTU6OJUʹ୅ΘΔςεςΟϯάϑϨʔ ϜϫʔΫ w STQFDSBJMTͱҰॹʹ࢖͏ͱ޾ͤʹͳΕΔ w IUUQTHJUIVCDPNSTQFDSTQFD

  40. $BQZCBSB

  41. w ౷߹ςετ༻ςεςΟϯάϑϨʔϜϫʔΫ w ϑΥʔϜʹ஋ΛೖΕͯTVCNJUΛԡͯ͠ɺ Έ͍ͨͳ͜ͱΛ%4-Ͱॻ͚Δ w IUUQTHJUIVCDPNKOJDLMBT DBQZCBSB

  42. (VBSE

  43. w ϑΝΠϧΛฤूͨ͠ΒࣗಈͰςετΛ࣮ߦ w IUUQTHJUIVCDPNHVBSEHVBSE

  44. 4QPSL

  45. w SBLFTQFDͷىಈ஗͗͢ϫϩλ w %3Cͱݺ͹ΕΔ෼ࢄΦϒδΣΫτϓϩά ϥϛϯά༻ͷαʔόʔʹ3BJMTΛϩʔυ͠ ͓ͯ͘ w ىಈ଎͗͢ϫϩλ w IUUQTHJUIVCDPNTQPSLSCTQPSL

  46. ศརͳϠπΒपΓ

  47. $BSSJFS8BWF

  48. w ը૾ͷΞοϓϩʔυ ը૾͡Όͳͯ͘΋ྑ͍ w ଟػೳ ը૾ͷϦαΠζ΍ΫϩοϓͳͲ w GPHͱҰॹʹ࢖༻͢Δ͜ͱͰɺ"844ɺ (PPHMF4UPSBHFͳͲͷετϨʔδʹ؆୯ʹ ը૾Λอଘ͢Δ͜ͱ͕Ͱ͖Δ

    w IUUQTHJUIVCDPNKOJDLMBT DBSSJFSXBWF
  49. $BQJTUSBOP

  50. w σϓϩΠπʔϧ w %4-Ͱॻ͚Δ w ͕ɺ׳Εͳ͍ͱઃఆ͕ͩΔ͍ w ϦϞʔταʔόʔͰίϚϯυΛ͚ͨͨΔҝɺσ ϓϩΠҎ֎Ͱ΋࢖༻Մೳ Կ͔ΛΠϯετʔϧ͢

    Δͱ͔ w IUUQTHJUIVCDPNDBQJTUSBOPDBQJTUSBOP
  51. BXFTPNF@QSJOU

  52. w Q΍QQΑΓΦϒδΣΫτΛݟ΍͘͢ DPOTPMFʹදࣔͯ͘͠ΕΔ w ΧελϚΠζՄೳ w IUUQTHJUIVCDPNNJDIBFMEW BXFTPNF@QSJOU

  53. None
  54. ྑ͍ײ͡ͳHFN͕ ͋ͬͨΒڭ͑ͯԼ͞ ͍ɻ͓ئ͍͠·͢ɻ

  55. ͝ਗ਼ௌ͋Γ͕ͱ͏͝ ͍͟·ͨ͠ɻ