Suche senden
Hochladen
merb.intro
âą
Als PPT, PDF herunterladen
âą
11 gefÀllt mir
âą
1,669 views
P
pjb3
Folgen
An introduction the Merb Framework
Weniger lesen
Mehr lesen
Technologie
Melden
Teilen
Melden
Teilen
1 von 47
Jetzt herunterladen
Empfohlen
Spring 2.0
Spring 2.0
gouthamrv
Â
Getting More Traffic From Search Advanced Seo For Developers Presentation
Getting More Traffic From Search Advanced Seo For Developers Presentation
Seo Indonesia
Â
Spring 2.0
Spring 2.0
goutham v
Â
Advanced SEO for Web Developers
Advanced SEO for Web Developers
Nathan Buggia
Â
Cucumber: How I Slice It
Cucumber: How I Slice It
linoj
Â
Story Driven Web Development
Story Driven Web Development
Michael Koukoullis
Â
Beautiful Java EE - PrettyFaces
Beautiful Java EE - PrettyFaces
Lincoln III
Â
The New Renaissance of JavaScript
The New Renaissance of JavaScript
Hamlet Batista
Â
Empfohlen
Spring 2.0
Spring 2.0
gouthamrv
Â
Getting More Traffic From Search Advanced Seo For Developers Presentation
Getting More Traffic From Search Advanced Seo For Developers Presentation
Seo Indonesia
Â
Spring 2.0
Spring 2.0
goutham v
Â
Advanced SEO for Web Developers
Advanced SEO for Web Developers
Nathan Buggia
Â
Cucumber: How I Slice It
Cucumber: How I Slice It
linoj
Â
Story Driven Web Development
Story Driven Web Development
Michael Koukoullis
Â
Beautiful Java EE - PrettyFaces
Beautiful Java EE - PrettyFaces
Lincoln III
Â
The New Renaissance of JavaScript
The New Renaissance of JavaScript
Hamlet Batista
Â
My Story With Flickr
My Story With Flickr
Jose Martinez
Â
Query Classification on Steroids with BERT
Query Classification on Steroids with BERT
Hamlet Batista
Â
Fast Loading JavaScript
Fast Loading JavaScript
Aaron Peters
Â
Web APIs & Google APIs
Web APIs & Google APIs
Pamela Fox
Â
Rendering SEO Manifesto - Why we need to go beyond JavaScript SEO
Rendering SEO Manifesto - Why we need to go beyond JavaScript SEO
Onely
Â
Debugging rendering problems at scale
Debugging rendering problems at scale
Giacomo Zecchini
Â
PrettyFaces: SEO, Dynamic, Parameters, Bookmarks, Navigation for JSF / JSF2 (...
PrettyFaces: SEO, Dynamic, Parameters, Bookmarks, Navigation for JSF / JSF2 (...
Lincoln III
Â
Solving Complex JavaScript Issues and Leveraging Semantic HTML5
Solving Complex JavaScript Issues and Leveraging Semantic HTML5
Hamlet Batista
Â
Recipe book flipped-coding
Recipe book flipped-coding
Milecia McGregor
Â
Mashups & APIs
Mashups & APIs
Pamela Fox
Â
GTM Clowns, fun and hacks - Search Elite - May 2017 Gerry White
GTM Clowns, fun and hacks - Search Elite - May 2017 Gerry White
Gerry White
Â
Make your PWA feel more like an app
Make your PWA feel more like an app
Ănder Ceylan
Â
Getting the Most Out of OpenSocial Gadgets
Getting the Most Out of OpenSocial Gadgets
Atlassian
Â
seo savage 2012
seo savage 2012
darkthrone287
Â
Schema.org and the changing world of Rich Results - SEOEdinburgh Meetup
Schema.org and the changing world of Rich Results - SEOEdinburgh Meetup
Geoff Kennedy
Â
Double Loop: TDD & BDD Done Right!
Double Loop: TDD & BDD Done Right!
Jessica Mauerhan
Â
Migrating a large scale banking app to compose
Migrating a large scale banking app to compose
Fatih Giris
Â
Make Your Own Damn SEO Tools (Using Google Docs!)
Make Your Own Damn SEO Tools (Using Google Docs!)
Sean Malseed
Â
Google Wave 20/20: Product, Protocol, Platform
Google Wave 20/20: Product, Protocol, Platform
Pamela Fox
Â
Grant Concept Brij Slides
Grant Concept Brij Slides
brijsingh
Â
Publicity Art
Publicity Art
David Page
Â
Weblogs Wikis E Portfolios
Weblogs Wikis E Portfolios
Bruce Perry
Â
Weitere Àhnliche Inhalte
Was ist angesagt?
My Story With Flickr
My Story With Flickr
Jose Martinez
Â
Query Classification on Steroids with BERT
Query Classification on Steroids with BERT
Hamlet Batista
Â
Fast Loading JavaScript
Fast Loading JavaScript
Aaron Peters
Â
Web APIs & Google APIs
Web APIs & Google APIs
Pamela Fox
Â
Rendering SEO Manifesto - Why we need to go beyond JavaScript SEO
Rendering SEO Manifesto - Why we need to go beyond JavaScript SEO
Onely
Â
Debugging rendering problems at scale
Debugging rendering problems at scale
Giacomo Zecchini
Â
PrettyFaces: SEO, Dynamic, Parameters, Bookmarks, Navigation for JSF / JSF2 (...
PrettyFaces: SEO, Dynamic, Parameters, Bookmarks, Navigation for JSF / JSF2 (...
Lincoln III
Â
Solving Complex JavaScript Issues and Leveraging Semantic HTML5
Solving Complex JavaScript Issues and Leveraging Semantic HTML5
Hamlet Batista
Â
Recipe book flipped-coding
Recipe book flipped-coding
Milecia McGregor
Â
Mashups & APIs
Mashups & APIs
Pamela Fox
Â
GTM Clowns, fun and hacks - Search Elite - May 2017 Gerry White
GTM Clowns, fun and hacks - Search Elite - May 2017 Gerry White
Gerry White
Â
Make your PWA feel more like an app
Make your PWA feel more like an app
Ănder Ceylan
Â
Getting the Most Out of OpenSocial Gadgets
Getting the Most Out of OpenSocial Gadgets
Atlassian
Â
seo savage 2012
seo savage 2012
darkthrone287
Â
Schema.org and the changing world of Rich Results - SEOEdinburgh Meetup
Schema.org and the changing world of Rich Results - SEOEdinburgh Meetup
Geoff Kennedy
Â
Double Loop: TDD & BDD Done Right!
Double Loop: TDD & BDD Done Right!
Jessica Mauerhan
Â
Migrating a large scale banking app to compose
Migrating a large scale banking app to compose
Fatih Giris
Â
Make Your Own Damn SEO Tools (Using Google Docs!)
Make Your Own Damn SEO Tools (Using Google Docs!)
Sean Malseed
Â
Google Wave 20/20: Product, Protocol, Platform
Google Wave 20/20: Product, Protocol, Platform
Pamela Fox
Â
Was ist angesagt?
(19)
My Story With Flickr
My Story With Flickr
Â
Query Classification on Steroids with BERT
Query Classification on Steroids with BERT
Â
Fast Loading JavaScript
Fast Loading JavaScript
Â
Web APIs & Google APIs
Web APIs & Google APIs
Â
Rendering SEO Manifesto - Why we need to go beyond JavaScript SEO
Rendering SEO Manifesto - Why we need to go beyond JavaScript SEO
Â
Debugging rendering problems at scale
Debugging rendering problems at scale
Â
PrettyFaces: SEO, Dynamic, Parameters, Bookmarks, Navigation for JSF / JSF2 (...
PrettyFaces: SEO, Dynamic, Parameters, Bookmarks, Navigation for JSF / JSF2 (...
Â
Solving Complex JavaScript Issues and Leveraging Semantic HTML5
Solving Complex JavaScript Issues and Leveraging Semantic HTML5
Â
Recipe book flipped-coding
Recipe book flipped-coding
Â
Mashups & APIs
Mashups & APIs
Â
GTM Clowns, fun and hacks - Search Elite - May 2017 Gerry White
GTM Clowns, fun and hacks - Search Elite - May 2017 Gerry White
Â
Make your PWA feel more like an app
Make your PWA feel more like an app
Â
Getting the Most Out of OpenSocial Gadgets
Getting the Most Out of OpenSocial Gadgets
Â
seo savage 2012
seo savage 2012
Â
Schema.org and the changing world of Rich Results - SEOEdinburgh Meetup
Schema.org and the changing world of Rich Results - SEOEdinburgh Meetup
Â
Double Loop: TDD & BDD Done Right!
Double Loop: TDD & BDD Done Right!
Â
Migrating a large scale banking app to compose
Migrating a large scale banking app to compose
Â
Make Your Own Damn SEO Tools (Using Google Docs!)
Make Your Own Damn SEO Tools (Using Google Docs!)
Â
Google Wave 20/20: Product, Protocol, Platform
Google Wave 20/20: Product, Protocol, Platform
Â
Andere mochten auch
Grant Concept Brij Slides
Grant Concept Brij Slides
brijsingh
Â
Publicity Art
Publicity Art
David Page
Â
Weblogs Wikis E Portfolios
Weblogs Wikis E Portfolios
Bruce Perry
Â
Sub Prime Crisis Explained
Sub Prime Crisis Explained
David Page
Â
Weblogs - Wikis - ePortfolios
Weblogs - Wikis - ePortfolios
Bruce Perry
Â
Creation Story Rewritten
Creation Story Rewritten
David Page
Â
Google App Engine
Google App Engine
David Page
Â
Para Mis Friendss
Para Mis Friendss
guestcb5109
Â
States Of Matter[1]
States Of Matter[1]
wolffer87
Â
The Application Development Lifecycle
The Application Development Lifecycle
David Page
Â
Cosas
Cosas
anitabtt
Â
Brij Singhs Ideas
Brij Singhs Ideas
brijsingh
Â
I sette peccati capitali dell'albergatore (in tema di reputation) #tourismreload
I sette peccati capitali dell'albergatore (in tema di reputation) #tourismreload
Mirko Lalli
Â
The Yubikey
The Yubikey
David Page
Â
Travel Appeal Destination
Travel Appeal Destination
Mirko Lalli
Â
IntroducciĂłn tecnologĂa educativa
IntroducciĂłn tecnologĂa educativa
Carmen Leonor
Â
viamedia portfolio presentation pdf
viamedia portfolio presentation pdf
Ram Ravi
Â
States Of Matter Power Point
States Of Matter Power Point
wolffer87
Â
Retooling you CMS- Charting a Successful Course
Retooling you CMS- Charting a Successful Course
coastalcandy
Â
Andere mochten auch
(19)
Grant Concept Brij Slides
Grant Concept Brij Slides
Â
Publicity Art
Publicity Art
Â
Weblogs Wikis E Portfolios
Weblogs Wikis E Portfolios
Â
Sub Prime Crisis Explained
Sub Prime Crisis Explained
Â
Weblogs - Wikis - ePortfolios
Weblogs - Wikis - ePortfolios
Â
Creation Story Rewritten
Creation Story Rewritten
Â
Google App Engine
Google App Engine
Â
Para Mis Friendss
Para Mis Friendss
Â
States Of Matter[1]
States Of Matter[1]
Â
The Application Development Lifecycle
The Application Development Lifecycle
Â
Cosas
Cosas
Â
Brij Singhs Ideas
Brij Singhs Ideas
Â
I sette peccati capitali dell'albergatore (in tema di reputation) #tourismreload
I sette peccati capitali dell'albergatore (in tema di reputation) #tourismreload
Â
The Yubikey
The Yubikey
Â
Travel Appeal Destination
Travel Appeal Destination
Â
IntroducciĂłn tecnologĂa educativa
IntroducciĂłn tecnologĂa educativa
Â
viamedia portfolio presentation pdf
viamedia portfolio presentation pdf
Â
States Of Matter Power Point
States Of Matter Power Point
Â
Retooling you CMS- Charting a Successful Course
Retooling you CMS- Charting a Successful Course
Â
Ăhnlich wie merb.intro
What's new in Rails 2?
What's new in Rails 2?
brynary
Â
Haml & Sass presentation
Haml & Sass presentation
bryanbibat
Â
Master pages ppt
Master pages ppt
Iblesoft
Â
Building Web Interface On Rails
Building Web Interface On Rails
Wen-Tien Chang
Â
Boston Computing Review - Ruby on Rails
Boston Computing Review - Ruby on Rails
John Brunswick
Â
JSP Custom Tags
JSP Custom Tags
BG Java EE Course
Â
EPiServer Web Parts
EPiServer Web Parts
EPiServer Meetup Oslo
Â
Html5
Html5
dotNETUserGroupDnipro
Â
KMUTNB - Internet Programming 3/7
KMUTNB - Internet Programming 3/7
phuphax
Â
User Experience is dead. Long live the user experience!
User Experience is dead. Long live the user experience!
Greg Bell
Â
HTML5 Overview
HTML5 Overview
reybango
Â
Developing and testing ajax components
Developing and testing ajax components
Ignacio Coloma
Â
Rich faces
Rich faces
BG Java EE Course
Â
OSDC 2009 Rails Turtorial
OSDC 2009 Rails Turtorial
Yi-Ting Cheng
Â
Meta tags1
Meta tags1
hapy
Â
Lecture 1 - Comm Lab: Web @ ITP
Lecture 1 - Comm Lab: Web @ ITP
yucefmerhi
Â
Ajax
Ajax
wangjiaz
Â
Lecture 6 - Comm Lab: Web @ ITP
Lecture 6 - Comm Lab: Web @ ITP
yucefmerhi
Â
APEX Themes and Templates
APEX Themes and Templates
InSync Conference
Â
Evolution of API With Blogging
Evolution of API With Blogging
Takatsugu Shigeta
Â
Ăhnlich wie merb.intro
(20)
What's new in Rails 2?
What's new in Rails 2?
Â
Haml & Sass presentation
Haml & Sass presentation
Â
Master pages ppt
Master pages ppt
Â
Building Web Interface On Rails
Building Web Interface On Rails
Â
Boston Computing Review - Ruby on Rails
Boston Computing Review - Ruby on Rails
Â
JSP Custom Tags
JSP Custom Tags
Â
EPiServer Web Parts
EPiServer Web Parts
Â
Html5
Html5
Â
KMUTNB - Internet Programming 3/7
KMUTNB - Internet Programming 3/7
Â
User Experience is dead. Long live the user experience!
User Experience is dead. Long live the user experience!
Â
HTML5 Overview
HTML5 Overview
Â
Developing and testing ajax components
Developing and testing ajax components
Â
Rich faces
Rich faces
Â
OSDC 2009 Rails Turtorial
OSDC 2009 Rails Turtorial
Â
Meta tags1
Meta tags1
Â
Lecture 1 - Comm Lab: Web @ ITP
Lecture 1 - Comm Lab: Web @ ITP
Â
Ajax
Ajax
Â
Lecture 6 - Comm Lab: Web @ ITP
Lecture 6 - Comm Lab: Web @ ITP
Â
APEX Themes and Templates
APEX Themes and Templates
Â
Evolution of API With Blogging
Evolution of API With Blogging
Â
KĂŒrzlich hochgeladen
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
Rafal Los
Â
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
MIND CTI
Â
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
Â
presentation ICT roal in 21st century education
presentation ICT roal in 21st century education
jfdjdjcjdnsjd
Â
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Roshan Dwivedi
Â
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
apidays
Â
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
debabhi2
Â
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
The Digital Insurer
Â
đŹ The future of MySQL is Postgres đ
đŹ The future of MySQL is Postgres đ
RTylerCroy
Â
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
SynarionITSolutions
Â
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
The Digital Insurer
Â
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
Gabriella Davis
Â
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
Boston Institute of Analytics
Â
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
apidays
Â
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Miguel AraĂșjo
Â
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
Â
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
The Digital Insurer
Â
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Neo4j
Â
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
The Digital Insurer
Â
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
wesley chun
Â
KĂŒrzlich hochgeladen
(20)
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
Â
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
Â
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Â
presentation ICT roal in 21st century education
presentation ICT roal in 21st century education
Â
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Â
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Â
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
Â
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Â
đŹ The future of MySQL is Postgres đ
đŹ The future of MySQL is Postgres đ
Â
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
Â
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
Â
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
Â
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
Â
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
Â
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Â
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
Â
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
Â
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Â
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Â
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
Â
merb.intro
1.
merb.intro
:by => "Paul Barry" "Paul Barry"
2.
What is Merb?
A Ruby MVC Web Framework similar to Rails, but: âą Small âą Fast âą Light âą Less Opinionated
3.
Create Your App
$ merb-gen app blog ~/projects
4.
Configure Your App
config/init.rb use_orm :activerecord dependency "merb-action-args" dependency "merb-assets" dependency "merb-builder" dependency "merb-parts" dependency "merb_activerecord" dependency "merb_helpers"
5.
Configure Your Database
config/database.yml development: adapter: sqlite3 database: dev.db timeout: 5000 test: adapter: sqlite3 database: test.db timeout: 5000
6.
Generate a Model
$ merb-gen model article title:string body:text ~/projects/blog
7.
Create the Table
$ rake db:migrate ~/projects/blog
8.
Create an Article
$ merb -i >> article = Article.new(:title => 'First Post')â => #<Article id: nil...> >> article.body = 'Lorem ipsum dolor sit amet...' => "Lorem ipsum dolor sit amet..." >> article.save!=> true ~/projects/blog
9.
Create a Controller
app/controllers/articles.rb class Articles < Application def index "Hello, World!" end end
10.
Create RESTful Route
config/router.rb Merb :: Router .prepare do | r | r.resources :articles end
11.
Start Merb $
merb ~/projects/blog
12.
View the controller
13.
Named Route config/router.rb
r.match( "/sleep/:time" ).to( :controller => "sleeper" , :action => "execute" ).name( :sleeper )â
14.
Blocking Controller app/controllers/sleeper.rb
class Sleeper < Application def execute (time = 5 )â sleep time.to_i "I slept for #{time} seconds" end end
15.
Non-Blocking Controller app/controllers/sleeper.rb
class Sleeper < Application def execute (time = 5 )â render_deferred do sleep time.to_i "I slept for #{time} seconds" end end end
16.
Demo
17.
Create a Real
Action app/controllers/articles.rb class Articles < Application def index @articles = Article .find( :all , :limit => 5 , :order => "created_at desc" )â display @articles end end
18.
Create the View
app/views/articles/index.html.erb <% throw_content :page_title, "Articles" %><%= partial 'article', :with => @articles %> <% throw_content :page_title , "Articles" %> <% throw_content :sidebar do %> <%= partial 'shared/me' %> <% end %> <%= partial 'article' , :with => @articles %>
19.
Create the Partial
app/views/articles/_article.html.erb <% throw_content :page_title, "Articles" %><%= partial 'article', :with => @articles %> <div id= "article_ <%= article.id %> " class= "article" > <h2> <%= link_to h(article.title), url( :article , article) %> </h2> <p class= "posted_at" > Posted at <%= article.created_at.strftime "%l:%M %p" %> on <%= article.created_at.strftime "%A, %B %e" %> <p> <%= h(article.body) %> </p> </div>
20.
Create the Shared
Partial app/views/shared/_me.html.erb <% throw_content :page_title, "Articles" %><%= partial 'article', :with => @articles %> <h2> About Me </h2> <%= image_tag "me.jpg" %>
21.
Create the Layout
app/views/layout/articles.html.erb <% throw_content :page_title, "Articles" %><%= partial 'article', :with => @articles %> <html> <head> <title> Merb Blog - <%= catch_content :page_title %> </title> <%= css_include_tag 'application' %> <%= catch_content :html_head %> </head> <body> <div id= "page" > <div id= "header" ><h1> Merb Blog </h1></div> <div id= "content" > <%= catch_content %> </div> <div id= "sidebar" > <%= catch_content :sidebar %> </div> </div> </body> </html>
22.
View Articles
23.
Create the Show
Action app/controllers/articles.rb <% throw_content :page_title, "Articles" %><%= partial 'article', :with => @articles %> def show (id)â @article = Article .find_by_id(id)â raise NotFound unless @article display @article end
24.
Create the Show
View app/views/show.html.erb <% throw_content :page_title, "Articles" %><%= partial 'article', :with => @articles %> <% throw_content :page_title , h( @article .title) %> <% throw_content :sidebar do %> <%= partial 'shared/me' %> <% end %> <%= partial 'article' , :with => @article %>
25.
View Article <%
throw_content :page_title, "Articles" %><%= partial 'article', :with => @articles %>
26.
Add RSS Mime
Type config/init.rb <% throw_content :page_title, "Articles" %><%= partial 'article', :with => @articles %> Merb .add_mime_type :rss , nil , %w[text/xml]
27.
Add RSS to
Provides app/controllers/articles.rb <% throw_content :page_title, "Articles" %><%= partial 'article', :with => @articles %> class Articles < Application provides :rss def index @articles = Article .find( :all , :limit => 5 , :order => "created_at desc" )â display @articles end end
28.
Create RSS Builder
app/views/articles/index.rss.builder <% throw_content :page_title, "Articles" %><%= partial 'article', :with => @articles %> xml.instruct! :xml , :version => "1.0" xml.rss :version => "2.0" do xml.channel do xml.title "Merb Blog" xml.description "The greatest blog in the world" xml.link " http://merb.blog " @articles .each do | a | xml.item do xml.title a.title xml.description a.body xml.pubDate a.created_at.to_s( :rfc822 )â xml.link url( :article , a)â xml.guid url( :article , a)â end end end end
29.
Add Auto-Discovery Link
app/views/articles/index.html.erb <% throw_content :page_title, "Articles" %><%= partial 'article', :with => @articles %> <% throw_content :html_head do %> <link rel= "alternate" type= "application/rss+xml" title= "RSS" href= "/articles.rss" /> <% end %>
30.
RSS Icon <%
throw_content :page_title, "Articles" %><%= partial 'article', :with => @articles %>
31.
RSS Feed <%
throw_content :page_title, "Articles" %><%= partial 'article', :with => @articles %>
32.
33.
Recent Article Part
View <% throw_content :page_title, "Articles" %><%= partial 'article', :with => @articles %> app/parts/views/recent_articles/index.html.erb <h2> Recent Articles </h2> <ul> <% @articles .each do | a | %> <li> <%= link_to h(a.title), url( :article , a) %> </li> <% end %> </ul>
34.
Add Part to
View <% throw_content :page_title, "Articles" %><%= partial 'article', :with => @articles %> app/views/articles/show.html.erb <% throw_content :sidebar do %> <%= partial 'shared/me' %> <%= part RecentArticles => "index" , :limit => 5 %> <% end %>
35.
Recent Articles <%
throw_content :page_title, "Articles" %><%= partial 'article', :with => @articles %>
36.
Generate Admin Controller
<% throw_content :page_title, "Articles" %><%= partial 'article', :with => @articles %> ~/projects/blog $ merb-gen resource_controller admin/articles create app/controllers/admin create app/helpers/admin create app/views/admin/articles create app/controllers/admin/articles.rb create app/helpers/admin/articles_helper.rb create app/views/admin/articles/edit.html.erb create app/views/admin/articles/index.html.erb create app/views/admin/articles/new.html.erb create app/views/admin/articles/show.html.erb
37.
Add Admin Route
<% throw_content :page_title, "Articles" %><%= partial 'article', :with => @articles %> config/router.rb Merb :: Router .prepare do | r | r.namespace :admin do | admin | admin.resources :articles end r.resources :articles end
38.
View Routes <%
throw_content :page_title, "Articles" %><%= partial 'article', :with => @articles %> ~/projects/blog $ merb -i >> merb.show_routes Named Routes edit_admin_article: /admin/articles/:id/edit delete_admin_article: /admin/articles/:id/delete article: /articles/:id admin_articles: /admin/articles new_article: /articles/new admin_article: /admin/articles/:id edit_article: /articles/:id/edit articles: /articles new_admin_article: /admin/articles/new delete_article: /articles/:id/delete
39.
Admin Articles View
<% throw_content :page_title, "Articles" %><%= partial 'article', :with => @articles %> app/views/admin/articles/index.html.erb <h2> Articles </h2> <p> <%= link_to "Create New Article" , url( :new_admin_article ) %> <ul> <% @articles .each do | a | %> <li> <%= link_to h(a.title), url( :admin_article , a) %> </li> <% end %> </ul>
40.
Admin New Article
View <% throw_content :page_title, "Articles" %><%= partial 'article', :with => @articles %> app/views/admin/articles/new.html.erb <h2> New Article </h2> <%= partial 'form' %>
41.
Admin Edit Article
View <% throw_content :page_title, "Articles" %><%= partial 'article', :with => @articles %> app/views/admin/articles/edit.html.erb <h2> Edit Article </h2> <%= partial 'form' %>
42.
Admin Article Form
<% throw_content :page_title, "Articles" %><%= partial 'article', :with => @articles %> app/views/admin/articles/_form.html.erb <%= error_messages_for :article %> <% form_for @article , :action => url( :admin_article , @article ) do %> <div class= "field" > <%= text_control :title , :label => 'Title' %> </div> <div class= "field" > <%= text_area_control :body , :rows => 20 , :cols => 80 %> <div> <div class= "buttons" > <%= submit_button 'Save' %> </div> <% end %>
43.
Create a New
Article <% throw_content :page_title, "Articles" %><%= partial 'article', :with => @articles %>
44.
Admin Article View
<% throw_content :page_title, "Articles" %><%= partial 'article', :with => @articles %> app/views/admin/articles/show.html.erb <h2> <%=h @article .title %> </h2> <p> <%=h @article .body %> </p> <hr /> <%= link_to "Back to Articles" , url( :admin_articles ) %> | <%= link_to "Edit this Article" , url( :edit_admin_article , @article ) %>
45.
So is it
worth it?
46.
Numbers <% throw_content
:page_title, "Articles" %><%= partial 'article', :with => @articles %> min avg max stddev rails GET /articles 37.4 45.7 47.0 2.0 rails GET /articles/1 44.0 45.1 45.8 0.6 merb GET /articles 70.0 71.1 73.0 0.8 merb GET /articles/1 88.0 107.1 110.1 7.2 requests/second
47.
Thank You! http://merbivore.com
#merb on irc.freenode.net http://mwrc2008.conf reaks.com/02zygmuntowicz.html http://paulbarry.co m Resources
Jetzt herunterladen