SlideShare ist ein Scribd-Unternehmen logo
1 von 40
Downloaden Sie, um offline zu lesen
柴田 博志
SHIBATA Hiroshi
paperboy&co.
asakusa.rb
paperboy&co., Inc.
Awesome Inquiry Management System
発表場所 大江戸Ruby会議03 2013-03-16(Sat)
ぼくのかんがえた
さいきょうの問い合
わせ管理システム
self
SHIBATA Hiroshi(@hsbt)
asakusa.rb
1. www.ruby-lang.org
4. eban/shugo 業
3. Ruby Application CI
2. bugs.ruby-lang.org
本題
やりたい
こと
@cs
お問い合わせの検索が凄
く遅くて5分経っても応答
無かったり、10分経って
見つからないとか...
mjd!?
@hsbt
(そういや solr とか触ら
んとなあ、せっかくの機会
だし作って見るか)
何とかしますよ!!1
@hsbt
@cs
mjd!!1
5日後...
source 'https://rubygems.org'
gem 'rails', '~> 4.0.0.beta1'
gem 'activerecord-nulldb-adapter'
gem 'mysql2'
# gem 'pg'
gem 'slim-rails'
gem 'bootstrap-sass'
gem 'jquery-rails'
gem 'kaminari'
gem 'omniauth-github'
gem 'rails_config'
gem 'sunspot_rails'
gem 'progress_bar'
gem 'system_timer' if RUBY_VERSION < '1.9'
group :assets do
gem 'sass-rails', '~> 4.0.0.beta1'
gem 'coffee-rails', '~> 4.0.0.beta1'
gem 'therubyracer'
gem 'uglifier'
end
group :development, :test do
gem 'sunspot_solr'
gem 'spring'
gem 'pry-rails'
gem 'forgery'
gem 'factory_girl_rails'
end
group :production do
gem 'puma'
end
5. sunspot
1. Rails4
4. omniauth
3. slim
2. nulldb
基本方針
1. スキーマレス
2. Engine活用
t_foo_bar
create_date
update_date
(ただし文字列)
Settings.inquiries_tables.each do |table|
class_name = table.name.singularize.classify
self.class.const_set class_name, Class.new(ActiveRecord::Base)
class_name.constantize.class_eval do |klass|
klass.establish_connection table.database.to_hash
klass.table_name = table.name
def klass.text_columns
columns.select{|c| [:string, :text].include?(c.type) && c.name !=
settings.created_at }.map{|c| c.name.to_sym}
end
def klass.display_columns
settings.display_columns.map(&:to_sym)
end
def klass.settings
Settings.inquiries_tables.detect{|table| table.name == self.table_name}
end
def created_at
Time.parse(send(self.class.settings.created_at.to_sym))
rescue
nil
end if table.created_at && !respond_to?(:created_at)
attr_accessible *text_columns if Rails.env.development?
searchable do
text *text_columns
time :created_at if settings.created_at
end
end
end if Settings.inquiries_tables.present?
MySQLのスキーマ定
義を見て、その中から
テキストっぽいカラム
だけを取り出して、そ
のカラム名のシンボル
を配列で返すのってど
うやるんだっけ???
def klass.text_columns
columns.select do |c|
[:string, :text].include? c.type
end.map{|c| c.name.to_sym}
end
module DynamicModel
def all
Settings.inquiries_tables.map do |table|
table.name.singularize.classify.constantize
end
end
module_function :all
end
class InquiriesController < ApplicationController
before_filter :login_required
respond_to :html
def index
@inquiries = []
DynamicModel.all.each do |klass|
@inquiries << klass.all(:limit => 5)
end
@inquiries.flatten!
end
def search
@inquiries = []
DynamicModel.all.each do |klass|
@inquiries << klass.search do
fulltext params[:q]
end.results
end
@inquiries.flatten!
@inquiries =
Kaminari.paginate_array(@inquiries).page(params[:page]).per(25)
end
def show
@inquiry = params[:class_name].constantize.find(params[:id])
end
end
- @inquiries.each do |inquiry|
.row-fluid
.span12
.fieldset
.legend = link_to inquiry.send(inquiry.class.primary_key.to_sym),
inquiry_path(inquiry, :class_name => inquiry.class)
table.table
- inquiry.class.text_columns.each do |c|
- next unless inquiry.class.display_columns.include? c
tr
td= c.to_s
td= truncate(inquiry.send(c.to_sym), length: 140)
- if inquiry.class.settings.created_at
tr
td= inquiry.class.settings.created_at.to_s
td= inquiry.send(inquiry.class.settings.created_at.to_sym)
1. rbenv
4. nginx
3. supervisord
2. solr
だいたいできた
@cs
めっさ早( ゚д゚)
YATTA!
@hsbt
https://github.com/hsbt/
whispered
https://github.com/hsbt/
whispered-puppet

Weitere ähnliche Inhalte

Ähnlich wie Awesome Inquiry Management System

Continuous Delivery in Ruby World
Continuous Delivery in Ruby WorldContinuous Delivery in Ruby World
Continuous Delivery in Ruby World
Hiroshi SHIBATA
 
Google Summer Of Code 2008
Google Summer Of Code 2008Google Summer Of Code 2008
Google Summer Of Code 2008
Byeongweon Moon
 
090608-TogoWS REST
090608-TogoWS REST090608-TogoWS REST
090608-TogoWS REST
ocha_kaneko
 
Open Source Type Pad Mobile
Open Source Type Pad MobileOpen Source Type Pad Mobile
Open Source Type Pad Mobile
Hiroshi Sakai
 
20090822 Arg Cafe.Final
20090822 Arg Cafe.Final20090822 Arg Cafe.Final
20090822 Arg Cafe.Final
kulibrarians
 
Out-002-Suc3rum-20090720
Out-002-Suc3rum-20090720Out-002-Suc3rum-20090720
Out-002-Suc3rum-20090720
Sukusuku Scrum
 

Ähnlich wie Awesome Inquiry Management System (20)

Gorm @ gopher china
Gorm @ gopher chinaGorm @ gopher china
Gorm @ gopher china
 
PostgreSQLで学ぶBoyer-Moore-Horspoolアルゴリズム
PostgreSQLで学ぶBoyer-Moore-HorspoolアルゴリズムPostgreSQLで学ぶBoyer-Moore-Horspoolアルゴリズム
PostgreSQLで学ぶBoyer-Moore-Horspoolアルゴリズム
 
Cloud era -『クラウド時代』マッシュアップ技術による地方からの世界発信
Cloud era -『クラウド時代』マッシュアップ技術による地方からの世界発信Cloud era -『クラウド時代』マッシュアップ技術による地方からの世界発信
Cloud era -『クラウド時代』マッシュアップ技術による地方からの世界発信
 
Continuous Delivery in Ruby World
Continuous Delivery in Ruby WorldContinuous Delivery in Ruby World
Continuous Delivery in Ruby World
 
Google Summer Of Code 2008
Google Summer Of Code 2008Google Summer Of Code 2008
Google Summer Of Code 2008
 
090608-TogoWS REST
090608-TogoWS REST090608-TogoWS REST
090608-TogoWS REST
 
产业
产业产业
产业
 
20090522 Candycane
20090522 Candycane20090522 Candycane
20090522 Candycane
 
Open Source Type Pad Mobile
Open Source Type Pad MobileOpen Source Type Pad Mobile
Open Source Type Pad Mobile
 
Gorm
GormGorm
Gorm
 
2009-09-11 / YAPC::Asia 2009
2009-09-11 / YAPC::Asia 20092009-09-11 / YAPC::Asia 2009
2009-09-11 / YAPC::Asia 2009
 
20090822 Arg Cafe.Final
20090822 Arg Cafe.Final20090822 Arg Cafe.Final
20090822 Arg Cafe.Final
 
Search Engines Chapter 1 Summary
Search Engines Chapter 1 SummarySearch Engines Chapter 1 Summary
Search Engines Chapter 1 Summary
 
20090418 イケテルRails勉強会 第1部Rails編
20090418 イケテルRails勉強会 第1部Rails編20090418 イケテルRails勉強会 第1部Rails編
20090418 イケテルRails勉強会 第1部Rails編
 
ZOZOTOWNのマルチクラウドへの挑戦と挫折、そして未来
ZOZOTOWNのマルチクラウドへの挑戦と挫折、そして未来ZOZOTOWNのマルチクラウドへの挑戦と挫折、そして未来
ZOZOTOWNのマルチクラウドへの挑戦と挫折、そして未来
 
20210113「アウトプットしないのは知的な便秘」の影響力 -2020年版- ~How To Output Intellectual Constipa...
20210113「アウトプットしないのは知的な便秘」の影響力 -2020年版-  ~How To Output Intellectual Constipa...20210113「アウトプットしないのは知的な便秘」の影響力 -2020年版-  ~How To Output Intellectual Constipa...
20210113「アウトプットしないのは知的な便秘」の影響力 -2020年版- ~How To Output Intellectual Constipa...
 
Speed matters, So why is your site so slow?
Speed matters, So why is your site so slow?Speed matters, So why is your site so slow?
Speed matters, So why is your site so slow?
 
커리어특강자료_글로벌커리어 및 인공지능 커리어
커리어특강자료_글로벌커리어 및 인공지능 커리어커리어특강자료_글로벌커리어 및 인공지능 커리어
커리어특강자료_글로벌커리어 및 인공지능 커리어
 
tDiary Party 2.1
tDiary Party 2.1tDiary Party 2.1
tDiary Party 2.1
 
Out-002-Suc3rum-20090720
Out-002-Suc3rum-20090720Out-002-Suc3rum-20090720
Out-002-Suc3rum-20090720
 

Mehr von Hiroshi SHIBATA

Mehr von Hiroshi SHIBATA (20)

Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Deep dive into Ruby's require - RubyConf Taiwan 2023
Deep dive into Ruby's require - RubyConf Taiwan 2023Deep dive into Ruby's require - RubyConf Taiwan 2023
Deep dive into Ruby's require - RubyConf Taiwan 2023
 
How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?
 
How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?How resolve Gem dependencies in your code?
How resolve Gem dependencies in your code?
 
Ruby コミッターと歩む Ruby を用いたプロダクト開発
Ruby コミッターと歩む Ruby を用いたプロダクト開発Ruby コミッターと歩む Ruby を用いたプロダクト開発
Ruby コミッターと歩む Ruby を用いたプロダクト開発
 
Why ANDPAD commit Ruby and RubyKaigi?
Why ANDPAD commit Ruby and RubyKaigi?Why ANDPAD commit Ruby and RubyKaigi?
Why ANDPAD commit Ruby and RubyKaigi?
 
RailsGirls から始める エンジニアリングはじめの一歩
RailsGirls から始める エンジニアリングはじめの一歩RailsGirls から始める エンジニアリングはじめの一歩
RailsGirls から始める エンジニアリングはじめの一歩
 
How to develop the Standard Libraries of Ruby?
How to develop the Standard Libraries of Ruby?How to develop the Standard Libraries of Ruby?
How to develop the Standard Libraries of Ruby?
 
The details of CI/CD environment for Ruby
The details of CI/CD environment for RubyThe details of CI/CD environment for Ruby
The details of CI/CD environment for Ruby
 
Dependency Resolution with Standard Libraries
Dependency Resolution with Standard LibrariesDependency Resolution with Standard Libraries
Dependency Resolution with Standard Libraries
 
Roadmap for RubyGems 4 and Bundler 3
Roadmap for RubyGems 4 and Bundler 3Roadmap for RubyGems 4 and Bundler 3
Roadmap for RubyGems 4 and Bundler 3
 
The Future of library dependency management of Ruby
 The Future of library dependency management of Ruby The Future of library dependency management of Ruby
The Future of library dependency management of Ruby
 
Ruby Security the Hard Way
Ruby Security the Hard WayRuby Security the Hard Way
Ruby Security the Hard Way
 
OSS Security the hard way
OSS Security the hard wayOSS Security the hard way
OSS Security the hard way
 
The Future of library dependency manageement of Ruby
The Future of library dependency manageement of RubyThe Future of library dependency manageement of Ruby
The Future of library dependency manageement of Ruby
 
The Future of Dependency Management for Ruby
The Future of Dependency Management for RubyThe Future of Dependency Management for Ruby
The Future of Dependency Management for Ruby
 
The Future of Bundled Bundler
The Future of Bundled BundlerThe Future of Bundled Bundler
The Future of Bundled Bundler
 
What's new in RubyGems3
What's new in RubyGems3What's new in RubyGems3
What's new in RubyGems3
 
Productive Organization with Ruby
Productive Organization with RubyProductive Organization with Ruby
Productive Organization with Ruby
 

Kürzlich hochgeladen

Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
FIDO Alliance
 

Kürzlich hochgeladen (20)

The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptx
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
Human Expert Website Manual WCAG 2.0 2.1 2.2 Audit - Digital Accessibility Au...
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream Processing
 
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
 
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cf
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
الأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهلهالأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهله
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdfFrisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform Engineering
 

Awesome Inquiry Management System