SlideShare a Scribd company logo
Submit Search
Upload
Routes Generation. Susanin will Help! - Alexey Osipenko
Report
Share
Ruby Meditation
Ruby Meditation
Follow
•
0 likes
•
448 views
1
of
44
Routes Generation. Susanin will Help! - Alexey Osipenko
•
0 likes
•
448 views
Report
Share
Download Now
Download to read offline
Technology
Ruby Meditation #15 May 13, 2017 Dnipro, I Coworking Hub
Read more
Ruby Meditation
Ruby Meditation
Follow
Recommended
Vim Text Object by
Vim Text Object
Tomohiro Nishimura
1.5K views
•
34 slides
"Full Stack frameworks or a story about how to reconcile Front (good) and Bac... by
"Full Stack frameworks or a story about how to reconcile Front (good) and Bac...
Fwdays
206 views
•
112 slides
d.mix: Programming by a Sample by
d.mix: Programming by a Sample
Leslie W
1.1K views
•
49 slides
Introduction to Django by
Introduction to Django
Joaquim Rocha
2.2K views
•
40 slides
Django introduction by
Django introduction
Joaquim Rocha
934 views
•
35 slides
Python Code Camp for Professionals 3/4 by
Python Code Camp for Professionals 3/4
DEVCON
256 views
•
49 slides
More Related Content
Similar to Routes Generation. Susanin will Help! - Alexey Osipenko
The Best (and Worst) of Django by
The Best (and Worst) of Django
Jacob Kaplan-Moss
35.6K views
•
53 slides
Modern Release Engineering in a Nutshell - Why Researchers should Care! by
Modern Release Engineering in a Nutshell - Why Researchers should Care!
Bram Adams
751 views
•
140 slides
Pyramid Lighter/Faster/Better web apps by
Pyramid Lighter/Faster/Better web apps
Dylan Jay
10.6K views
•
33 slides
Rails for Beginners - Le Wagon by
Rails for Beginners - Le Wagon
Alex Benoit
147 views
•
97 slides
Html5 bug by
Html5 bug
Alberto Granzotto
325 views
•
47 slides
Socket applications by
Socket applications
João Moura
601 views
•
121 slides
Similar to Routes Generation. Susanin will Help! - Alexey Osipenko
(20)
The Best (and Worst) of Django by Jacob Kaplan-Moss
The Best (and Worst) of Django
Jacob Kaplan-Moss
•
35.6K views
Modern Release Engineering in a Nutshell - Why Researchers should Care! by Bram Adams
Modern Release Engineering in a Nutshell - Why Researchers should Care!
Bram Adams
•
751 views
Pyramid Lighter/Faster/Better web apps by Dylan Jay
Pyramid Lighter/Faster/Better web apps
Dylan Jay
•
10.6K views
Rails for Beginners - Le Wagon by Alex Benoit
Rails for Beginners - Le Wagon
Alex Benoit
•
147 views
Html5 bug by Alberto Granzotto
Html5 bug
Alberto Granzotto
•
325 views
Socket applications by João Moura
Socket applications
João Moura
•
601 views
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB) by Ontico
Паразитируем на React-экосистеме (Angular 4+) / Алексей Охрименко (IPONWEB)
Ontico
•
434 views
Mashing Up The Guardian by Michael Brunton-Spall
Mashing Up The Guardian
Michael Brunton-Spall
•
2K views
Mashing Up The Guardian by Michael Brunton-Spall
Mashing Up The Guardian
Michael Brunton-Spall
•
917 views
Golang slidesaudrey by Audrey Lim
Golang slidesaudrey
Audrey Lim
•
1.1K views
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017) by James Titcumb
Kicking off with Zend Expressive and Doctrine ORM (PHP UK 2017)
James Titcumb
•
3.1K views
Keeping the frontend under control with Symfony and Webpack by Ignacio Martín
Keeping the frontend under control with Symfony and Webpack
Ignacio Martín
•
6.4K views
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines by Tikal Knowledge
JBUG 11 - Django-The Web Framework For Perfectionists With Deadlines
Tikal Knowledge
•
4.7K views
OSCamp #4 on Foreman | CLI tools with Foreman by Martin Bačovský by NETWAYS
OSCamp #4 on Foreman | CLI tools with Foreman by Martin Bačovský
NETWAYS
•
83 views
Exploring the Titanium CLI - Codestrong 2012 by Chris Barber
Exploring the Titanium CLI - Codestrong 2012
Chris Barber
•
8.3K views
Building a Single Page Application using Ember.js ... for fun and profit by Ben Limmer
Building a Single Page Application using Ember.js ... for fun and profit
Ben Limmer
•
2.3K views
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later by Haehnchen
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
Haehnchen
•
1.7K views
Connecting your Python App to OpenERP through OOOP by raimonesteve
Connecting your Python App to OpenERP through OOOP
raimonesteve
•
2K views
Rails::Engine by Flavian Missi
Rails::Engine
Flavian Missi
•
800 views
Introduction to React Native Workshop by Ignacio Martín
Introduction to React Native Workshop
Ignacio Martín
•
1.5K views
More from Ruby Meditation
Is this Legacy or Revenant Code? - Sergey Sergyenko | Ruby Meditation 30 by
Is this Legacy or Revenant Code? - Sergey Sergyenko | Ruby Meditation 30
Ruby Meditation
207 views
•
22 slides
Life with GraphQL API: good practices and unresolved issues - Roman Dubrovsky... by
Life with GraphQL API: good practices and unresolved issues - Roman Dubrovsky...
Ruby Meditation
462 views
•
141 slides
Where is your license, dude? - Viacheslav Miroshnychenko | Ruby Meditation 29 by
Where is your license, dude? - Viacheslav Miroshnychenko | Ruby Meditation 29
Ruby Meditation
210 views
•
49 slides
Dry-validation update. Dry-validation vs Dry-schema 1.0 - Aleksandra Stolyar ... by
Dry-validation update. Dry-validation vs Dry-schema 1.0 - Aleksandra Stolyar ...
Ruby Meditation
1.6K views
•
59 slides
How to cook Rabbit on Production - Bohdan Parshentsev | Ruby Meditation 28 by
How to cook Rabbit on Production - Bohdan Parshentsev | Ruby Meditation 28
Ruby Meditation
366 views
•
23 slides
How to cook Rabbit on Production - Serhiy Nazarov | Ruby Meditation 28 by
How to cook Rabbit on Production - Serhiy Nazarov | Ruby Meditation 28
Ruby Meditation
459 views
•
20 slides
More from Ruby Meditation
(20)
Is this Legacy or Revenant Code? - Sergey Sergyenko | Ruby Meditation 30 by Ruby Meditation
Is this Legacy or Revenant Code? - Sergey Sergyenko | Ruby Meditation 30
Ruby Meditation
•
207 views
Life with GraphQL API: good practices and unresolved issues - Roman Dubrovsky... by Ruby Meditation
Life with GraphQL API: good practices and unresolved issues - Roman Dubrovsky...
Ruby Meditation
•
462 views
Where is your license, dude? - Viacheslav Miroshnychenko | Ruby Meditation 29 by Ruby Meditation
Where is your license, dude? - Viacheslav Miroshnychenko | Ruby Meditation 29
Ruby Meditation
•
210 views
Dry-validation update. Dry-validation vs Dry-schema 1.0 - Aleksandra Stolyar ... by Ruby Meditation
Dry-validation update. Dry-validation vs Dry-schema 1.0 - Aleksandra Stolyar ...
Ruby Meditation
•
1.6K views
How to cook Rabbit on Production - Bohdan Parshentsev | Ruby Meditation 28 by Ruby Meditation
How to cook Rabbit on Production - Bohdan Parshentsev | Ruby Meditation 28
Ruby Meditation
•
366 views
How to cook Rabbit on Production - Serhiy Nazarov | Ruby Meditation 28 by Ruby Meditation
How to cook Rabbit on Production - Serhiy Nazarov | Ruby Meditation 28
Ruby Meditation
•
459 views
Reinventing the wheel - why do it and how to feel good about it - Julik Tarkh... by Ruby Meditation
Reinventing the wheel - why do it and how to feel good about it - Julik Tarkh...
Ruby Meditation
•
462 views
Performance Optimization 101 for Ruby developers - Nihad Abbasov (ENG) | Ruby... by Ruby Meditation
Performance Optimization 101 for Ruby developers - Nihad Abbasov (ENG) | Ruby...
Ruby Meditation
•
475 views
Use cases for Serverless Technologies - Ruslan Tolstov (RUS) | Ruby Meditatio... by Ruby Meditation
Use cases for Serverless Technologies - Ruslan Tolstov (RUS) | Ruby Meditatio...
Ruby Meditation
•
320 views
The Trailblazer Ride from the If Jungle into a Civilised Railway Station - Or... by Ruby Meditation
The Trailblazer Ride from the If Jungle into a Civilised Railway Station - Or...
Ruby Meditation
•
285 views
What/How to do with GraphQL? - Valentyn Ostakh (ENG) | Ruby Meditation 27 by Ruby Meditation
What/How to do with GraphQL? - Valentyn Ostakh (ENG) | Ruby Meditation 27
Ruby Meditation
•
1.1K views
New features in Rails 6 - Nihad Abbasov (RUS) | Ruby Meditation 26 by Ruby Meditation
New features in Rails 6 - Nihad Abbasov (RUS) | Ruby Meditation 26
Ruby Meditation
•
577 views
Security Scanning Overview - Tetiana Chupryna (RUS) | Ruby Meditation 26 by Ruby Meditation
Security Scanning Overview - Tetiana Chupryna (RUS) | Ruby Meditation 26
Ruby Meditation
•
299 views
Teach your application eloquence. Logs, metrics, traces - Dmytro Shapovalov (... by Ruby Meditation
Teach your application eloquence. Logs, metrics, traces - Dmytro Shapovalov (...
Ruby Meditation
•
455 views
Best practices. Exploring - Ike Kurghinyan (RUS) | Ruby Meditation 26 by Ruby Meditation
Best practices. Exploring - Ike Kurghinyan (RUS) | Ruby Meditation 26
Ruby Meditation
•
204 views
Road to A/B testing - Alexey Vasiliev (ENG) | Ruby Meditation 25 by Ruby Meditation
Road to A/B testing - Alexey Vasiliev (ENG) | Ruby Meditation 25
Ruby Meditation
•
577 views
Concurrency in production. Real life example - Dmytro Herasymuk | Ruby Medita... by Ruby Meditation
Concurrency in production. Real life example - Dmytro Herasymuk | Ruby Medita...
Ruby Meditation
•
511 views
Data encryption for Ruby web applications - Dmytro Shapovalov (RUS) | Ruby Me... by Ruby Meditation
Data encryption for Ruby web applications - Dmytro Shapovalov (RUS) | Ruby Me...
Ruby Meditation
•
299 views
Rails App performance at the limit - Bogdan Gusiev by Ruby Meditation
Rails App performance at the limit - Bogdan Gusiev
Ruby Meditation
•
418 views
GDPR. Next Y2K in 2018? - Anton Tkachov | Ruby Meditation #23 by Ruby Meditation
GDPR. Next Y2K in 2018? - Anton Tkachov | Ruby Meditation #23
Ruby Meditation
•
179 views
Recently uploaded
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... by
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
James Anderson
92 views
•
32 slides
Network Source of Truth and Infrastructure as Code revisited by
Network Source of Truth and Infrastructure as Code revisited
Network Automation Forum
27 views
•
45 slides
Ransomware is Knocking your Door_Final.pdf by
Ransomware is Knocking your Door_Final.pdf
Security Bootcamp
59 views
•
46 slides
"Node.js Development in 2024: trends and tools", Nikita Galkin by
"Node.js Development in 2024: trends and tools", Nikita Galkin
Fwdays
11 views
•
38 slides
Melek BEN MAHMOUD.pdf by
Melek BEN MAHMOUD.pdf
MelekBenMahmoud
14 views
•
1 slide
Microsoft Power Platform.pptx by
Microsoft Power Platform.pptx
Uni Systems S.M.S.A.
53 views
•
38 slides
Recently uploaded
(20)
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N... by James Anderson
GDG Cloud Southlake 28 Brad Taylor and Shawn Augenstein Old Problems in the N...
James Anderson
•
92 views
Network Source of Truth and Infrastructure as Code revisited by Network Automation Forum
Network Source of Truth and Infrastructure as Code revisited
Network Automation Forum
•
27 views
Ransomware is Knocking your Door_Final.pdf by Security Bootcamp
Ransomware is Knocking your Door_Final.pdf
Security Bootcamp
•
59 views
"Node.js Development in 2024: trends and tools", Nikita Galkin by Fwdays
"Node.js Development in 2024: trends and tools", Nikita Galkin
Fwdays
•
11 views
Melek BEN MAHMOUD.pdf by MelekBenMahmoud
Melek BEN MAHMOUD.pdf
MelekBenMahmoud
•
14 views
Microsoft Power Platform.pptx by Uni Systems S.M.S.A.
Microsoft Power Platform.pptx
Uni Systems S.M.S.A.
•
53 views
GDSC CTU First Meeting Party by National Yang Ming Chiao Tung University
GDSC CTU First Meeting Party
National Yang Ming Chiao Tung University
•
11 views
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas... by Bernd Ruecker
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
Bernd Ruecker
•
40 views
"Surviving highload with Node.js", Andrii Shumada by Fwdays
"Surviving highload with Node.js", Andrii Shumada
Fwdays
•
22 views
2024: A Travel Odyssey The Role of Generative AI in the Tourism Universe by Simone Puorto
2024: A Travel Odyssey The Role of Generative AI in the Tourism Universe
Simone Puorto
•
12 views
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f... by TrustArc
TrustArc Webinar - Managing Online Tracking Technology Vendors_ A Checklist f...
TrustArc
•
11 views
Mini-Track: Challenges to Network Automation Adoption by Network Automation Forum
Mini-Track: Challenges to Network Automation Adoption
Network Automation Forum
•
13 views
MVP and prioritization.pdf by rahuldharwal141
MVP and prioritization.pdf
rahuldharwal141
•
31 views
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by Network Automation Forum
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Network Automation Forum
•
34 views
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading... by The Digital Insurer
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading...
The Digital Insurer
•
18 views
Info Session November 2023.pdf by AleksandraKoprivica4
Info Session November 2023.pdf
AleksandraKoprivica4
•
13 views
Case Study Copenhagen Energy and Business Central.pdf by Aitana
Case Study Copenhagen Energy and Business Central.pdf
Aitana
•
16 views
The Research Portal of Catalonia: Growing more (information) & more (services) by CSUC - Consorci de Serveis Universitaris de Catalunya
The Research Portal of Catalonia: Growing more (information) & more (services)
CSUC - Consorci de Serveis Universitaris de Catalunya
•
80 views
Democratising digital commerce in India-Report by Kapil Khandelwal (KK)
Democratising digital commerce in India-Report
Kapil Khandelwal (KK)
•
18 views
Evolving the Network Automation Journey from Python to Platforms by Network Automation Forum
Evolving the Network Automation Journey from Python to Platforms
Network Automation Forum
•
13 views
Routes Generation. Susanin will Help! - Alexey Osipenko
1.
cimon.io Алексей Осипенко cimon.io «URL generation
in Rails» Hello I’m Alexey
2.
cimon.io Алексей Осипенко cimon.io «Susanin»
3.
cimon.io Rails 5.1
4.
cimon.io Rails 5.1 Direct Resolved routes &
5.
cimon.io Rails 5.1 direct(:homepage) { "http://www.rubyonrails.org" }
6.
cimon.io Rails 5.1 direct(:homepage) { "http://www.rubyonrails.org" } homepage_url()
7.
cimon.io Rails 5.1 direct :commentable
do |model| [ model, anchor: model.dom_id ] end
8.
cimon.io Rails 5.1 commentable_url(resource) direct :commentable
do |model| [ model, anchor: model.dom_id ] end
9.
cimon.io What's the problem?
10.
cimon.io resources :companies do resources
:projects do resources :comments resources :issues do resources :comments end end end
11.
cimon.io companies_projects_issues_comments_path( comment.issue.project.company, comment.issue.project, comment.issue, comment )
12.
cimon.io comments_path(comment)
13.
cimon.io url_for(comment)
14.
cimon.io url_for([comment])
15.
cimon.io everything is resource or collection
16.
cimon.io everything is resource or collection or parent
17.
cimon.io link_to(resource.name, [resource])
18.
cimon.io Admin::UsersController Client::ProfilesController PublicApp::ProfilesController
19.
cimon.io Admin::UsersController Client::ProfilesController PublicApp::ProfilesController link_to resource.name, [:admin,
resource] link_to resource.name, [:client, resource] link_to resource.name, [:public, resource]
20.
cimon.io Admin::UsersController Client::ProfilesController PublicApp::ProfilesController link_to resource.name, [resource] link_to
resource.name, [resource] link_to resource.name, [resource]
21.
cimon.io Admin::UsersController Client::ProfilesController PublicApp::ProfilesController link_to resource.name, [resource] link_to
resource.name, [resource] link_to resource.name, [resource] User
22.
cimon.io Admin::ProjectsController Client::MyProjectsController PublicApp::ProjectsController link_to resource.name, [resource] link_to
resource.name, [resource] link_to resource.name, [resource] Project
23.
cimon.io url_for [:edit, :client,
resource]
24.
cimon.io url_for [:edit, resource]
25.
cimon.io url_for [ :edit, :client, resource.project.company, resource.project, resource ]
26.
namespace :client do resource
:profiles end namespace :admin do resources :users end namespace :public_app do resource :profiles end
27.
module Client class ApplicationController def
url_for([User] = resource) super([:client, resource]) end end end
28.
module Client class ApplicationController def
users_url(resource) client_users_url(resource) end end end
29.
module Client class ApplicationController def
url_for([..., User, ...] = resource) url_for([..., :client, resource, ...]) end end end
30.
module Client class ApplicationController def
url_for([..., User, ...] = resource) url_for([..., resource.company, resource, ...]) end def url_for([..., Company, ...]) url_for([:client, current_company]) end end end
31.
url_for([user]) url_for([:client, current_company, user])
32.
cimon.io user company, user
:client, company, user
33.
module Client class ApplicationController susanin({ [User]
=> ->(user) { [user.company, user]}, [Company] => ->(company) { [:client, company] }, }) end end
34.
susanin({ [:client] => ->(_)
{ [:jericho] }, [User] => ->(r) { [r.company, r] }, [Project] => ->(r) { [:client, r] }, [Company] => ->(r) { [:client, r] }, })
35.
susanin({ [:client] => ->(_)
{ [:jericho] }, [User] => ->(r) { [r.company, r] }, [Project] => ->(r) { [:client, r] }, [Company] => ->(r) { [:client, r] }, }) url_for([user]) url_for([:jericho, company, user]) jericho_company_user_url(company, user)
36.
susanin({ [:client] => ->(_)
{ [:jericho] }, [User] => ->(r) { [r.company, r] }, [Project] => ->(r) { [:client, r] }, [Company] => ->(r) { [:client, r] }, }) url_for([:edit, user]) url_for([:edit, company, user]) url_for([:edit, :client, company, user]) url_for([:edit, :jericho, company, user]) edit_jericho_company_user_url(company, user)
37.
susanin({ [User] => ->(r)
{ [:client, r] }, [:frontend, User] => ->(_, r) { [:public_app, r] }, }) [user] => [:client, user] [:frontend, user] => [:public_app, user] [:edit, user] => [:edit, :client, user] [:edit, :frontend, user] => [:edit, :public_app, user]
38.
susanin({ [User] => ->(r)
{ [:client, r] }, [:frontend, User] => ->(_, r) { [:public_app, r] }, }) url_for([:frontend, user]) url_for([:client, :frontend, user]) url_for([:public_app, user])
39.
[A, B, C]
=> (a, b, c) { [1] } [A] => (a) { [2] } [A, B] => (a, b) { [3] } [a, b, c] => [1]
40.
[A, B] =>
->(a, b) { 1 } [A] => ->(a) { 2 } [A, B, C] => ->(a, b, c) { 3 } [a, b, c] => [1, c]
41.
[A, B] =>
->(a, b) { [a] } [A] => ->(a) { 2 } [A, B, C] => ->(a, b, c) { 3 } [a, b, c] => [2, c]
42.
cimon.io
43.
alexey@cimon.io Спасибо за внимание telegram@aratak alexey.osipenko@fb.me
44.
https://t.me/itextrapolation