Submit Search
Try Rails4
2 likes
2,795 views
Mitsuyoshi Kawabata
初めてのRails4プログラミング。 Ruby/Railsのインストールからscaffold、モデルの関連、ファイルアップロードができます。 JAWS FESTA2013のハンズオンで使った資料です。
Technology
Education
Read more
1 of 13
Download now
Download to read offline
1
2
3
4
5
6
7
8
9
10
11
12
13
More Related Content
PDF
Sinatra and heroku for mac
Naoyuki Mitsuboshi
PDF
最近のRails事情 - 4.1!
Kenichi Tachibana
PDF
Rails
卓馬 三浦卓馬
KEY
エクストリーム・プログラミング開発事例TOP5 - Agile Japan 2011
Mitsuyoshi Kawabata
PDF
RedmineとGitHubのうまい関係
Mitsuyoshi Kawabata
PDF
2024 Trend Updates: What Really Works In SEO & Content Marketing
Search Engine Journal
PDF
Storytelling For The Web: Integrate Storytelling in your Design Process
Chiara Aliotta
PDF
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
OECD Directorate for Financial and Enterprise Affairs
Sinatra and heroku for mac
Naoyuki Mitsuboshi
最近のRails事情 - 4.1!
Kenichi Tachibana
Rails
卓馬 三浦卓馬
エクストリーム・プログラミング開発事例TOP5 - Agile Japan 2011
Mitsuyoshi Kawabata
RedmineとGitHubのうまい関係
Mitsuyoshi Kawabata
2024 Trend Updates: What Really Works In SEO & Content Marketing
Search Engine Journal
Storytelling For The Web: Integrate Storytelling in your Design Process
Chiara Aliotta
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
OECD Directorate for Financial and Enterprise Affairs
Featured
(20)
PDF
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
SocialHRCamp
PDF
2024 State of Marketing Report – by Hubspot
Marius Sescu
PDF
Everything You Need To Know About ChatGPT
Expeed Software
PDF
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
PDF
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
PDF
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
PDF
Skeleton Culture Code
Skeleton Technologies
PDF
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
PDF
Content Methodology: A Best Practices Report (Webinar)
contently
PPTX
How to Prepare For a Successful Job Search for 2024
Albert Qian
PDF
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
PDF
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
PDF
5 Public speaking tips from TED - Visualized summary
SpeakerHub
PDF
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
PDF
Getting into the tech field. what next
Tessa Mero
PDF
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
PDF
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
PDF
Introduction to Data Science
Christy Abraham Joy
PDF
Time Management & Productivity - Best Practices
Vit Horky
PDF
The six step guide to practical project management
MindGenius
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
SocialHRCamp
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
MindGenius
Ad
Try Rails4
1.
株式会社アジャイルウェア 代表取締役CEO 川端 光義 agilekawabata Try
Rails4.0 Ruby関西
2.
$ curl -L
https://get.rvm.io | bash -s stable Ruby Install Macのターミナルを立ち上げ 1. RVMのインストール 2. Rubyのインストール $ rvm install 2.0.0 $ rvm use 2.0.0 --default
3.
$ rvm gemset
create rtunes $ rvm gemset use rtunes $ gem i rails --no-ri --no-rdoc $ gem list Rails Install
4.
1. rTunesプロジェクト作成 2. 楽曲を管理する 3.
ジャンル別に管理する 4. 音楽を再生する rTunes
5.
$ rails new
rtunes $ cd rtunes $ rails s rTunesプロジェクト作成 http://localhost:3000/ ブラウザで確認
6.
楽曲を管理する MusicのScaffold 名前の必須 日本語化 $ rails g
scaffold music name:string artist:string $ rake db:migrate validates :name, :presence => true gem 'i18n_generators' $ bundle $ rails g i18n ja >> Gemfile >> 今 ja.ymlが取れない $ wget https://raw.github.com/svenfuchs/rails-i18n/master/rails/ locale/ja.yml -P config/locales/
7.
ジャンル別に管理する GenreのScaffold 音楽にジャンルの追加 $ rails g
scaffold genre name:string $ rake db:migrate $ rails g migration add_genre_id_to_musics genre_id:integer $ rake db:migrate belongs_to :genre >> music.rb def music_params params.require(:music).permit(:name, :artist, :genre_id) end >> musics_controller.rb
8.
ジャンル別に管理する (2) ジャンルのSelectBox 音楽リストにジャンルを表示 <div class="field"> <%=
f.label :genre %><br> <%= f.select :genre_id, Genre.all.collect {|genre| [genre.name, genre.id]} %> </div> <td><%= music.genre.name %></td>
9.
ジャンル別に管理する (2) ジャンルのSelectBox 音楽リストにジャンルを表示 <div class="field"> <%=
f.label :genre %><br> <%= f.select :genre_id, Genre.all.collect {|genre| [genre.name, genre.id]} %> </div> <td><%= music.genre.name %></td>
10.
音楽を再生する 音楽コントロール routesに追加 <td><audio src="<%= data_music_path(music)
%>" controls /></td> resources :musics do member do get 'data' end end def data @music = Music.find(params[:id]) send_data(Rails.root.join('public', @music.filename).read) end
11.
音楽を再生する (2) 音楽にファイル名の追加 ファイルアップロード $ rails
g migration add_filename_to_musics filename:string $ rake db:migrate <%= form_for(@music, :html => {:multipart => true}) do |f| %> ...... <div class="field"> <%= f.label :file %><br> <%= file_field_tag :file %> </div>
12.
音楽を再生する (3) ファイルアップロード def update file
= params[:file] File.open(Rails.root.join('public', file.original_filename), 'wb') do | f| f.write(file.read) end @music.filename = file.original_filename .... 音楽リスト画面で再生!
13.
Q&A Time
Download