{"id":3566,"date":"2022-01-10T15:47:14","date_gmt":"2022-01-10T15:47:14","guid":{"rendered":"http:\/\/the-codest.localhost\/blog\/ruby-on-rails-modularization-with-packwerk-episode-ii\/"},"modified":"2026-04-28T14:05:25","modified_gmt":"2026-04-28T14:05:25","slug":"ruby-on-rails-modularisering-med-packwerk-episod-ii","status":"publish","type":"post","link":"https:\/\/thecodest.co\/sv\/blog\/ruby-on-rails-modularization-with-packwerk-episode-ii\/","title":{"rendered":"Ruby on Rails-modularisering med Packwerk Episode II"},"content":{"rendered":"<h2 class=\"wp-block-heading\">Ans\u00f6kan som ett paket<\/h2>\n\n\n\n<p>Tillv\u00e4gag\u00e5ngss\u00e4ttet f\u00f6r att modularisera v\u00e5r applikation best\u00e5r i att konvertera hela applikationen till ett paket.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Skapa strukturen<\/h3>\n\n\n\n<p>F\u00f6rst m\u00e5ste vi skapa <code>app\/paket<\/code> mappen d\u00e4r vi kommer att placera alla v\u00e5ra paket. F\u00f6r att kunna isolera v\u00e5ra paket m\u00e5ste vi separera varje <strong>MVC-konceptet<\/strong> i en och samma mapp. Genom att ta <strong>KodTriage <a href=\"https:\/\/thecodest.co\/sv\/dictionary\/why-do-projects-fail\/\">projekt<\/a><\/strong> som exempel kommer vi att ha n\u00e5got som liknar f\u00f6ljande bild.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"\/app\/uploads\/2024\/05\/2.png\" alt=\"paketets struktur \" title=\"exempel p\u00e5 paketstruktur\"\/><\/figure>\n\n\n\n<p>Om vi f\u00f6rs\u00f6ker k\u00f6ra servern kommer den inte att hitta konstanterna. Det \u00e4r d\u00e4rf\u00f6r vi m\u00e5ste l\u00e4gga till en konfigurationsrad i v\u00e5r <code>applikation.rb<\/code><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">config.paths.add 'app\/packages', glob: '*\/{*,*\/concerns}', eager_load:true<\/code><\/pre>\n\n\n\n<p>Nu fungerar programmet, men det kan inte hitta vyerna, s\u00e5 vi m\u00e5ste l\u00e4gga till ytterligare en konfigurationsrad i v\u00e5r <code>applikation_controller.rb<\/code><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">append_view_path(Dir.glob(<a href=\"https:\/\/thecodest.co\/sv\/blog\/ways-to-increase-your-rails-performance\/\">R\u00e4ls<\/a>.root.join('app\/packages\/*\/views')))<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Skapa paketen<\/h3>\n\n\n\n<p>V\u00e5r struktur \u00e4r klar, s\u00e5 nu kan vi b\u00f6rja skapa paketen. F\u00f6r att g\u00f6ra det beh\u00f6ver vi bara l\u00e4gga till en<code>paket.yml<\/code> till varje mapp med f\u00f6ljande konfiguration:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">enforce_privacy: false\nenforce_dependencies: true<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"\/app\/uploads\/2024\/05\/1.png\" alt=\"paket.yml\" title=\"package.yml exempel\"\/><\/figure>\n\n\n\n<p><code>genomdriva_integritet<\/code>ger <a href=\"https:\/\/thecodest.co\/sv\/blog\/why-us-companies-are-opting-for-polish-developers\/\">oss<\/a> m\u00f6jligheten att isolera alla konstanter i paketet och arbeta med en offentlig <a href=\"https:\/\/thecodest.co\/sv\/blog\/compare-staff-augmentation-firms-that-excel-in-api-team-staffing-for-financial-technology-projects\/\">API<\/a>. F\u00f6r att exponera de offentliga konstanterna m\u00e5ste vi l\u00e4gga till konstanterna i till exempel&nbsp;<code>paket\/anv\u00e4ndare\/app\/public.<\/code>F\u00f6r n\u00e4rvarande ska vi st\u00e4lla in denna konfiguration till <em> falska<\/em>.<\/p>\n\n\n\n<p><code>genomdriva_beroenden<\/code> kommer att genomdriva beroendet av ett paket och kontrollera alla konstanta referenser. Om ett beroende inte \u00e4r explicit definierat kommer det att utg\u00f6ra en \u00f6vertr\u00e4delse av gr\u00e4nsen.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Validering av paketsystemet<\/h3>\n\n\n\n<p><strong>Packwerk<\/strong> fastst\u00e4llt ett kriterium som vi m\u00e5ste f\u00f6lja f\u00f6r att ha ett giltigt paketsystem. Vi kan b\u00f6rja k\u00f6ra <code>packwerk giltig<\/code> i v\u00e5r konsol.<\/p>\n\n\n\n<p>&nbsp;Detta kommer att kontrollera v\u00e5r mappstruktur, <strong>paketkonfiguration<\/strong>och autoload s\u00f6kv\u00e4gscache.<\/p>\n\n\n\n<p>Just nu \u00e4r v\u00e5r ans\u00f6kan inte giltig och vi m\u00e5ste \u00e5tg\u00e4rda lastv\u00e4garna i<strong><code>packwerk.yml<\/code>.<\/strong> F\u00f6r att g\u00f6ra detta beh\u00f6ver vi bara l\u00e4gga till de saknade v\u00e4garna.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\"># packwerk.yml\n\nladda_v\u00e4gar:\n.\n.\n.\n\n# Anv\u00e4ndare\n- app\/packages\/anv\u00e4ndare\/styrenheter\n- app\/packages\/anv\u00e4ndare\/modeller\n- app\/packages\/anv\u00e4ndare\/package.yml\n- app\/paket\/anv\u00e4ndare\/visningar<\/code><\/pre>\n\n\n\n<p>Nu \u00e4r vi redo att kontrollera gr\u00e4ns\u00f6vertr\u00e4delser i v\u00e5r applikation. F\u00f6r att kontrollera \u00f6vertr\u00e4delser kan vi k\u00f6ra<code>packwerk uppdatering-avvecklingar<\/code> kommer detta kommando att generera <code>avskrivna_referenser.yml<\/code> fil f\u00f6r varje paket. I varje fil hittar vi paketnamn, typ av \u00f6vertr\u00e4delse och fils\u00f6kv\u00e4g. Med all denna information vet vi var \u00f6vertr\u00e4delsen sker och vi kan fatta ett beslut om att l\u00f6sa den.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"\/app\/uploads\/2024\/05\/4.png\" alt=\"avskrivna_referenser.yml\" title=\"deprecated_references.yml exempel\"\/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\"># avskrivna_referenser.yml\n\n.\n.\n.\n\napp\/packages\/repos:\n  \"::Repo\":\n    \u00f6vertr\u00e4delser:\n    - Beroende\n    filer:\n    - app\/packages\/users\/models\/user.rb<\/code><\/pre>\n\n\n\n<p>I exemplet kommer vi att beskriva varje del av den information som genereras<br>av <strong>Packwerk<\/strong>.<\/p>\n\n\n\n<p>- <code>app\/paket\/repos<\/code> &nbsp;- paket d\u00e4r den konstanta \u00f6vertr\u00e4delsen \u00e4r<br>hittade.<\/p>\n\n\n\n<p>- <code>::Repo<\/code> &nbsp;- s\u00f6kv\u00e4g till filen som inneh\u00e5ller den kr\u00e4nkta konstanten.<\/p>\n\n\n\n<p>- <code>Beroende<\/code> &nbsp;- en typ av kr\u00e4nkning, antingen beroende eller integritet.<\/p>\n\n\n\n<p>- <code>app\/packages\/users\/models\/user.rb<\/code> &nbsp;- s\u00f6kv\u00e4g till filen som inneh\u00e5ller den kr\u00e4nkta konstanten.<\/p>\n\n\n\n<p>Som ett sista steg i detta avsnitt, gl\u00f6m inte att l\u00e4gga till de nya genererade fils\u00f6kv\u00e4garna i <code>packwerk.ym<\/code>l och k\u00f6r valideringarna igen.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Visualisering av beroenden<\/h3>\n\n\n\n<p>Med all information i package.yml och <code>avskrivna_referenser.yml<\/code>kan vi sedan<br>visualisera en graf \u00f6ver beroenden. F\u00f6r att g\u00f6ra det m\u00e5ste vi l\u00e4gga till en annan gem, i det h\u00e4r fallet kommer vi att anv\u00e4nda <a href=\"https:\/\/github.com\/mquan\/pocky\" rel=\"nofollow\">Pocky<\/a>.<\/p>\n\n\n\n<p>L\u00f6pande r\u00e4fsa <code>pocky:generera<\/code> kommer vi att generera en fil som heter <code>packwerk.png<\/code> d\u00e4r vi kan visualisera v\u00e5r f\u00f6rsta graf \u00f6ver beroenden.<\/p>\n\n\n\n<p>Med alla paket definierade kommer v\u00e5r graf att se ut s\u00e5 h\u00e4r.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"\/app\/uploads\/2024\/05\/5.png\" alt=\"graf utan accepterade beroenden\" title=\"graf utan accepterade beroenden exempel\"\/><\/figure>\n\n\n\n<p>beroenden redan finns, men det betyder inte att de accepteras av <strong>Packwerk<\/strong>. Till<br>acceptera ett beroende m\u00e5ste vi l\u00e4gga till beroendekonfigurationen i <code>paket.yml<\/code><br>i varje paket. Vi kommer att fokusera p\u00e5 <code>post_byggare<\/code> eftersom det \u00e4r ett paket utan cirkul\u00e4ra beroenden. Det \u00e4r v\u00e4rt att n\u00e4mna att <strong>Packwerk<\/strong> l\u00e5ter oss inte acceptera cirkul\u00e4ra beroenden.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\"># app\/packages\/mail_builders\/package.yml\n\n```ruby\nenforce_privacy: false\nenforce_dependencies: true\nBeroenden:\n- app\/packages\/docs\n- app\/packages\/fr\u00e5gor\n- app\/packages\/repos<\/code><\/pre>\n\n\n\n<p>N\u00e4r du har lagt till den h\u00e4r konfigurationen, <strong>Pocky<\/strong> kommer att f\u00e4rga de accepterade beroendena med gr\u00f6nt.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"\/app\/uploads\/2024\/05\/6.png\" alt=\"graf med accepterade beroenden \" title=\"graf utan accepterade beroenden exempel\"\/><\/figure>\n\n\n\n<p>Vi kan radera <code>avskrivna_referenser.yml<\/code> fr\u00e5n <code>app\/packages\/mail_builders<\/code> och k\u00f6r<br><code>packwerk uppdatering-avvecklingar<\/code> igen. Filen kommer inte att genereras igen eftersom alla<br>\u00f6vertr\u00e4delser \u00e5tg\u00e4rdades f\u00f6r detta paket. Det \u00e4r viktigt att n\u00e4mna att \u00e4ven om vi inte Graph med accepterade beroenden<\/p>\n\n\n\n<p><strong><a href=\"https:\/\/thecodest.co\/sv\/blog\/hire-ror-developer\/\">Ruby<\/a> p\u00e5 Rails modularisering med Packwerk<\/strong> v\u00e5r applikation kommer fortfarande att fungera som tidigare, men nu har vi fler<br>information f\u00f6r att fatta beslut och omarbeta.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Ta bort cirkul\u00e4ra beroenden<\/h3>\n\n\n\n<p>I v\u00e5r tidigare graf hade vi en hel del cirkul\u00e4ra beroenden som beh\u00f6vde l\u00f6sas p\u00e5 n\u00e5got s\u00e4tt. Vi har olika strategier f\u00f6r att g\u00f6ra det:<\/p>\n\n\n\n<p>- G\u00f6r ingenting,<\/p>\n\n\n\n<p>- Acceptera beroenden, Sammanfoga paket,<\/p>\n\n\n\n<p>- Flytta <a href=\"https:\/\/thecodest.co\/sv\/dictionary\/what-is-code-refactoring\/\">kod<\/a> mellan f\u00f6rpackningarna,<\/p>\n\n\n\n<p>- Duplicera en funktionalitet,&nbsp;<\/p>\n\n\n\n<p>- Utf\u00f6r beroendeinjektion eller beroendeinjektion med typning.<\/p>\n\n\n\n<p>Ett problem h\u00e4r \u00e4r att f\u00f6r att kunna g\u00f6ra en ordentlig refaktorisering m\u00e5ste vi k\u00e4nna till kodbasen. Jag \u00e4r inte s\u00e5 bekant med kodbasen i det h\u00e4r projektet eftersom jag tog det som ett exempel, s\u00e5 av praktiska sk\u00e4l kommer vi att g\u00e5 med den f\u00f6rsta strategin, g\u00f6r ingenting. \u00c4ven om vi kommer att undvika det mesta av refaktoriseringen vill vi arbeta med beroendena i <em>rot<\/em> paket.<\/p>\n\n\n\n<p>Rotpaketet inneh\u00e5ller allt lim fr\u00e5n <strong>Rails ramverk<\/strong>Alla klasser som vi \u00e4rver fr\u00e5n och f\u00e5r alla att fungera tillsammans. S\u00e5 f\u00f6r att l\u00f6sa de cirkul\u00e4ra beroendena kommer vi att skapa ett nytt paket som heter rails inom f\u00f6ljande steg:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Flytta alla application_-filer och mappar fr\u00e5n appen till <code>app\/paket\/rails<\/code>.<\/li>\n\n\n\n<li>Skapa en<code>paket.yml<\/code> f\u00f6r paketet med samma konfiguration som de tidigare paketen.<\/li>\n\n\n\n<li>L\u00e4gg till alla nya fils\u00f6kv\u00e4gar i <code>packwerk.yml<\/code>.<\/li>\n\n\n\n<li>L\u00e4gg till <code>app\/paket\/rails<\/code> som ett beroende av resten av paketen.<\/li>\n<\/ol>\n\n\n\n<p>N\u00e4r vi v\u00e4l har skapat paketet kommer vi att m\u00e4rka att det finns en hel del filer som kan struktureras om. Efter att ha flyttat allt till motsvarande paket och accepterat<br>beroenden f\u00e5r vi en ny struktur och en renare graf.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"\/app\/uploads\/2024\/05\/graph.png\" alt=\"Paketstruktur med r\u00e4lspaket \" title=\"Paketstruktur med exempel p\u00e5 j\u00e4rnv\u00e4gspaket\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"\/app\/uploads\/2024\/05\/8.png\" alt=\"Graf utan cirkul\u00e4ra beroenden vid roten\" title=\"Graf utan rot cirkul\u00e4ra beroenden exempel\"\/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Ta bort beroenden fr\u00e5n rotpaketet<\/h3>\n\n\n\n<p>Nu ser v\u00e5r graf mycket b\u00e4ttre ut, och det vore bra om vi kunde ta bort alla beroenden fr\u00e5n rotpaketet. Om vi kontrollerar deprecated_references.yml i rotpaketet kommer vi att m\u00e4rka att de flesta av dem \u00e4r fr\u00e5n <code>test<\/code> , <code>lib\/arbetsuppgifter<\/code> , <code>db<\/code> och <code>konfiguration<\/code><br>mapp. F\u00f6r att l\u00f6sa dessa beroenden kommer vi att skapa en testmapp i varje paket. Att ha n\u00e5got i stil med <code>app\/packages\/anv\u00e4ndare\/test<\/code>. D\u00e4refter kommer vi att utesluta <code>lib\/arbetsuppgifter<\/code> , <code>db<\/code> och <code>konfiguration<\/code>bland andra mappar fr\u00e5n <strong>Packwerk<\/strong> eftersom dessa beroenden inte \u00e4r s\u00e4rskilt viktiga i v\u00e5r analys och vi inte har n\u00e5got enkelt s\u00e4tt att l\u00f6sa dem. Vi kommer att l\u00e4gga till f\u00f6ljande i v\u00e5r <em>packwerk.yml<\/em>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">exkludera:\n- \"{bin,node_modules,script,tmp,vendor,lib,db,config,perf_scripts}\/**\/*\"\n- \"lib\/tasks\/**\/*.rake\"<\/code><\/pre>\n\n\n\n<p>N\u00e4r vi har flyttat alla tester fr\u00e5n rotpaketet och uteslutit mapparna fr\u00e5n analysen f\u00e5r vi en ny graf utan rotberoenden.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"\/app\/uploads\/2024\/05\/9.png\" alt=\"Graf utan rotberoenden\" title=\"Graf utan rotberoenden\"\/><\/figure>\n\n\n\n<p>Som vi kan se har vi fortfarande cirkul\u00e4ra beroenden i<code>anv\u00e4ndare<\/code> , <code>Repos<\/code> , och <code>Dokument<\/code> . \u00c4ven om vi inte l\u00f6ste dem har vi viktig information att f\u00f6rmedla nu. Vi vet att varje <a href=\"https:\/\/thecodest.co\/sv\/blog\/how-to-hire-the-best-outsourced-development-team-for-a-scaleup\/\">Team<\/a> som g\u00f6r \u00e4ndringar i ett av dessa paket kommer f\u00f6rmodligen att beh\u00f6va g\u00f6ra \u00e4ndringar i de paket som har det cirkul\u00e4ra beroendet. \u00c5 andra sidan vet vi att ett team kan arbeta med <code>github_fetchers<\/code> enbart, att veta vilka paket som \u00e4r<br>att p\u00e5verkas av f\u00f6r\u00e4ndringarna i varje \u00f6gonblick.<\/p>\n\n\n\n<p>Du kan hitta slutresultatet av projektet <a href=\"https:\/\/github.com\/niconisoria\/codetriage-packwerk\" rel=\"nofollow\">h\u00e4r<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">N\u00e4sta steg<\/h3>\n\n\n\n<p>Som ett n\u00e4sta steg kan du genomdriva konstant sekretess i varje paket och endast exponera det offentliga API som kommer att vara tillg\u00e4ngligt fr\u00e5n andra paket. Du kan enkelt konfigurera var ditt API ska placeras i <em>paket.yml<\/em>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"ruby\" class=\"language-ruby\">genomdriva_integritet: sant\nenforce_dependencies: true\npublic_path: min\/custom\/path\/<\/code><\/pre>\n\n\n\n<p><code> <\/code><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Slutsatser<\/h2>\n\n\n\n<p><strong>Packwerk<\/strong> ger oss mycket information om v\u00e5r applikation och med den informationen kan vi fatta beslut f\u00f6r att f\u00f6rb\u00e4ttra arbetsfl\u00f6det f\u00f6r v\u00e5ra team. \u00c4ven om processen verkade vara l\u00e5ng och med m\u00e5nga konfigurationer, beh\u00f6ver det inte alltid vara s\u00e5. Vi kan b\u00f6rja med att skapa paket endast f\u00f6r den nya kod som l\u00e4ggs till i v\u00e5r applikation och sedan modularisera gradvis. S\u00e5 nu kan vi b\u00f6rja prata om gradvis modularisering, det h\u00e4r \u00e4r ett koncept som introducerades av Stephan Hagemann <em>\"Vi kan f\u00f6r f\u00f6rsta g\u00e5ngen best\u00e4mma oss f\u00f6r att b\u00f6rja modularisera en del av koden p\u00e5 ett ambiti\u00f6st s\u00e4tt ... Detta g\u00f6r att vi kan skapa ett gradvis expanderande st\u00f6dsystem mot en b\u00e4ttre applikationsstruktur\".<\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">K\u00e4llor<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><a href=\"https:\/\/leanpub.com\/package-based-rails-applications\" rel=\"nofollow\">Gradvis modularisering f\u00f6r Ruby on Rails - Stephan Hagemann<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/shopify.engineering\/enforcing-modularity-rails-apps-packwerk\">Genomdriva modularitet i Rails-appar med Packwerk<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/github.com\/Shopify\/packwerk\">Packwerk Github<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/github.com\/niconisoria\/codetriage-packwerk\">K\u00e4llkod f\u00f6r artikeln<\/a><\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image\"><a href=\"https:\/\/thecodest.co\/contact\"><img decoding=\"async\" src=\"\/app\/uploads\/2024\/05\/cta_2.jpeg\" alt=\"Konsultation inom digital produktutveckling\"\/><\/a><\/figure>\n\n\n\n<p><strong>L\u00e4s mer om<\/strong><\/p>\n\n\n\n<p><a href=\"https:\/\/thecodest.co\/blog\/graphql-ruby-what-about-performance\">GraphQL Ruby. Hur \u00e4r det med prestanda?<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/thecodest.co\/blog\/rails-and-other-means-of-transport\">R\u00e4ls och andra transportmedel<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/thecodest.co\/blog\/rails-development-with-tmux-vim-fzf-ripgrep\">Rails-utveckling med TMUX, Vim, Fzf + Ripgrep<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>I det andra avsnittet av v\u00e5r Ruby on Rails-modularisering med Packwerk kommer vi att titta n\u00e4rmare p\u00e5 konceptet med applikation som ett paket.<\/p>","protected":false},"author":2,"featured_media":3567,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[8],"tags":[],"class_list":["post-3566","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software-development"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Ruby on Rails modularization with Packwerk Episode II - The Codest<\/title>\n<meta name=\"description\" content=\"In the second episode of our Ruby on Rails modularization with Packwerk we will take a close look at the concept of application as an package.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/thecodest.co\/sv\/blogg\/ruby-on-rails-modularisering-med-packwerk-episod-ii\/\" \/>\n<meta property=\"og:locale\" content=\"sv_SE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Ruby on Rails modularization with Packwerk Episode II\" \/>\n<meta property=\"og:description\" content=\"In the second episode of our Ruby on Rails modularization with Packwerk we will take a close look at the concept of application as an package.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/thecodest.co\/sv\/blogg\/ruby-on-rails-modularisering-med-packwerk-episod-ii\/\" \/>\n<meta property=\"og:site_name\" content=\"The Codest\" \/>\n<meta property=\"article:published_time\" content=\"2022-01-10T15:47:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-04-28T14:05:25+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/ruby_on_rails_modularization_with_packwerk_-__-_episode_2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"960\" \/>\n\t<meta property=\"og:image:height\" content=\"540\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"thecodest\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"thecodest\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minuter\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ruby-on-rails-modularization-with-packwerk-episode-ii\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ruby-on-rails-modularization-with-packwerk-episode-ii\\\/\"},\"author\":{\"name\":\"thecodest\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/person\\\/7e3fe41dfa4f4e41a7baad4c6e0d4f76\"},\"headline\":\"Ruby on Rails modularization with Packwerk Episode II\",\"datePublished\":\"2022-01-10T15:47:14+00:00\",\"dateModified\":\"2026-04-28T14:05:25+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ruby-on-rails-modularization-with-packwerk-episode-ii\\\/\"},\"wordCount\":1295,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ruby-on-rails-modularization-with-packwerk-episode-ii\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/ruby_on_rails_modularization_with_packwerk_-__-_episode_2.png\",\"articleSection\":[\"Software Development\"],\"inLanguage\":\"sv-SE\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/thecodest.co\\\/blog\\\/ruby-on-rails-modularization-with-packwerk-episode-ii\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ruby-on-rails-modularization-with-packwerk-episode-ii\\\/\",\"url\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ruby-on-rails-modularization-with-packwerk-episode-ii\\\/\",\"name\":\"Ruby on Rails modularization with Packwerk Episode II - The Codest\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ruby-on-rails-modularization-with-packwerk-episode-ii\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ruby-on-rails-modularization-with-packwerk-episode-ii\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/ruby_on_rails_modularization_with_packwerk_-__-_episode_2.png\",\"datePublished\":\"2022-01-10T15:47:14+00:00\",\"dateModified\":\"2026-04-28T14:05:25+00:00\",\"description\":\"In the second episode of our Ruby on Rails modularization with Packwerk we will take a close look at the concept of application as an package.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ruby-on-rails-modularization-with-packwerk-episode-ii\\\/#breadcrumb\"},\"inLanguage\":\"sv-SE\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/thecodest.co\\\/blog\\\/ruby-on-rails-modularization-with-packwerk-episode-ii\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"sv-SE\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ruby-on-rails-modularization-with-packwerk-episode-ii\\\/#primaryimage\",\"url\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/ruby_on_rails_modularization_with_packwerk_-__-_episode_2.png\",\"contentUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/05\\\/ruby_on_rails_modularization_with_packwerk_-__-_episode_2.png\",\"width\":960,\"height\":540},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/blog\\\/ruby-on-rails-modularization-with-packwerk-episode-ii\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/thecodest.co\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Ruby on Rails modularization with Packwerk Episode II\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#website\",\"url\":\"https:\\\/\\\/thecodest.co\\\/\",\"name\":\"The Codest\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/thecodest.co\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"sv-SE\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#organization\",\"name\":\"The Codest\",\"url\":\"https:\\\/\\\/thecodest.co\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"sv-SE\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/03\\\/thecodest-logo.svg\",\"contentUrl\":\"https:\\\/\\\/thecodest.co\\\/app\\\/uploads\\\/2024\\\/03\\\/thecodest-logo.svg\",\"width\":144,\"height\":36,\"caption\":\"The Codest\"},\"image\":{\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/pl.linkedin.com\\\/company\\\/codest\",\"https:\\\/\\\/clutch.co\\\/profile\\\/codest\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/thecodest.co\\\/#\\\/schema\\\/person\\\/7e3fe41dfa4f4e41a7baad4c6e0d4f76\",\"name\":\"thecodest\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"sv-SE\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g\",\"caption\":\"thecodest\"},\"url\":\"https:\\\/\\\/thecodest.co\\\/sv\\\/author\\\/thecodest\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Ruby on Rails Modularisering med Packwerk Avsnitt II - The Codest","description":"I det andra avsnittet av v\u00e5r Ruby on Rails-modularisering med Packwerk kommer vi att titta n\u00e4rmare p\u00e5 konceptet med applikation som ett paket.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/thecodest.co\/sv\/blogg\/ruby-on-rails-modularisering-med-packwerk-episod-ii\/","og_locale":"sv_SE","og_type":"article","og_title":"Ruby on Rails modularization with Packwerk Episode II","og_description":"In the second episode of our Ruby on Rails modularization with Packwerk we will take a close look at the concept of application as an package.","og_url":"https:\/\/thecodest.co\/sv\/blogg\/ruby-on-rails-modularisering-med-packwerk-episod-ii\/","og_site_name":"The Codest","article_published_time":"2022-01-10T15:47:14+00:00","article_modified_time":"2026-04-28T14:05:25+00:00","og_image":[{"width":960,"height":540,"url":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/ruby_on_rails_modularization_with_packwerk_-__-_episode_2.png","type":"image\/png"}],"author":"thecodest","twitter_card":"summary_large_image","twitter_misc":{"Written by":"thecodest","Est. reading time":"8 minuter"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/thecodest.co\/blog\/ruby-on-rails-modularization-with-packwerk-episode-ii\/#article","isPartOf":{"@id":"https:\/\/thecodest.co\/blog\/ruby-on-rails-modularization-with-packwerk-episode-ii\/"},"author":{"name":"thecodest","@id":"https:\/\/thecodest.co\/#\/schema\/person\/7e3fe41dfa4f4e41a7baad4c6e0d4f76"},"headline":"Ruby on Rails modularization with Packwerk Episode II","datePublished":"2022-01-10T15:47:14+00:00","dateModified":"2026-04-28T14:05:25+00:00","mainEntityOfPage":{"@id":"https:\/\/thecodest.co\/blog\/ruby-on-rails-modularization-with-packwerk-episode-ii\/"},"wordCount":1295,"commentCount":0,"publisher":{"@id":"https:\/\/thecodest.co\/#organization"},"image":{"@id":"https:\/\/thecodest.co\/blog\/ruby-on-rails-modularization-with-packwerk-episode-ii\/#primaryimage"},"thumbnailUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/ruby_on_rails_modularization_with_packwerk_-__-_episode_2.png","articleSection":["Software Development"],"inLanguage":"sv-SE","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/thecodest.co\/blog\/ruby-on-rails-modularization-with-packwerk-episode-ii\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/thecodest.co\/blog\/ruby-on-rails-modularization-with-packwerk-episode-ii\/","url":"https:\/\/thecodest.co\/blog\/ruby-on-rails-modularization-with-packwerk-episode-ii\/","name":"Ruby on Rails Modularisering med Packwerk Avsnitt II - The Codest","isPartOf":{"@id":"https:\/\/thecodest.co\/#website"},"primaryImageOfPage":{"@id":"https:\/\/thecodest.co\/blog\/ruby-on-rails-modularization-with-packwerk-episode-ii\/#primaryimage"},"image":{"@id":"https:\/\/thecodest.co\/blog\/ruby-on-rails-modularization-with-packwerk-episode-ii\/#primaryimage"},"thumbnailUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/ruby_on_rails_modularization_with_packwerk_-__-_episode_2.png","datePublished":"2022-01-10T15:47:14+00:00","dateModified":"2026-04-28T14:05:25+00:00","description":"I det andra avsnittet av v\u00e5r Ruby on Rails-modularisering med Packwerk kommer vi att titta n\u00e4rmare p\u00e5 konceptet med applikation som ett paket.","breadcrumb":{"@id":"https:\/\/thecodest.co\/blog\/ruby-on-rails-modularization-with-packwerk-episode-ii\/#breadcrumb"},"inLanguage":"sv-SE","potentialAction":[{"@type":"ReadAction","target":["https:\/\/thecodest.co\/blog\/ruby-on-rails-modularization-with-packwerk-episode-ii\/"]}]},{"@type":"ImageObject","inLanguage":"sv-SE","@id":"https:\/\/thecodest.co\/blog\/ruby-on-rails-modularization-with-packwerk-episode-ii\/#primaryimage","url":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/ruby_on_rails_modularization_with_packwerk_-__-_episode_2.png","contentUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/05\/ruby_on_rails_modularization_with_packwerk_-__-_episode_2.png","width":960,"height":540},{"@type":"BreadcrumbList","@id":"https:\/\/thecodest.co\/blog\/ruby-on-rails-modularization-with-packwerk-episode-ii\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/thecodest.co\/"},{"@type":"ListItem","position":2,"name":"Ruby on Rails modularization with Packwerk Episode II"}]},{"@type":"WebSite","@id":"https:\/\/thecodest.co\/#website","url":"https:\/\/thecodest.co\/","name":"Codest","description":"","publisher":{"@id":"https:\/\/thecodest.co\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/thecodest.co\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"sv-SE"},{"@type":"Organization","@id":"https:\/\/thecodest.co\/#organization","name":"Codest","url":"https:\/\/thecodest.co\/","logo":{"@type":"ImageObject","inLanguage":"sv-SE","@id":"https:\/\/thecodest.co\/#\/schema\/logo\/image\/","url":"https:\/\/thecodest.co\/app\/uploads\/2024\/03\/thecodest-logo.svg","contentUrl":"https:\/\/thecodest.co\/app\/uploads\/2024\/03\/thecodest-logo.svg","width":144,"height":36,"caption":"The Codest"},"image":{"@id":"https:\/\/thecodest.co\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/pl.linkedin.com\/company\/codest","https:\/\/clutch.co\/profile\/codest"]},{"@type":"Person","@id":"https:\/\/thecodest.co\/#\/schema\/person\/7e3fe41dfa4f4e41a7baad4c6e0d4f76","name":"thecodest","image":{"@type":"ImageObject","inLanguage":"sv-SE","@id":"https:\/\/secure.gravatar.com\/avatar\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5dbfe6a1e8c86e432e8812759e34e6fe82ebac75119ae3237a6c1311fa19caf4?s=96&d=mm&r=g","caption":"thecodest"},"url":"https:\/\/thecodest.co\/sv\/author\/thecodest\/"}]}},"_links":{"self":[{"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/posts\/3566","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/comments?post=3566"}],"version-history":[{"count":10,"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/posts\/3566\/revisions"}],"predecessor-version":[{"id":7983,"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/posts\/3566\/revisions\/7983"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/media\/3567"}],"wp:attachment":[{"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/media?parent=3566"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/categories?post=3566"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thecodest.co\/sv\/wp-json\/wp\/v2\/tags?post=3566"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}