{"id":29058722,"url":"https://github.com/foca/migajas","last_synced_at":"2025-06-27T07:04:06.735Z","repository":{"id":56883686,"uuid":"59747212","full_name":"foca/migajas","owner":"foca","description":"Tiny breadcrumbs for your Rack apps.","archived":false,"fork":false,"pushed_at":"2020-12-29T22:10:12.000Z","size":9,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-24T02:07:18.147Z","etag":null,"topics":["breadcrumbs","cuba","rack","rails","roda","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/foca.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-26T12:08:00.000Z","updated_at":"2020-12-29T22:53:20.000Z","dependencies_parsed_at":"2022-08-21T00:20:19.913Z","dependency_job_id":null,"html_url":"https://github.com/foca/migajas","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/foca/migajas","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foca%2Fmigajas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foca%2Fmigajas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foca%2Fmigajas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foca%2Fmigajas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/foca","download_url":"https://codeload.github.com/foca/migajas/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foca%2Fmigajas/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261952695,"owners_count":23235427,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["breadcrumbs","cuba","rack","rails","roda","ruby"],"created_at":"2025-06-27T07:01:44.218Z","updated_at":"2025-06-27T07:04:06.725Z","avatar_url":"https://github.com/foca.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Migajas\n\nMigajas is a tiny library for adding breadcrumbs to any Rack application. It was\ndesigned with routing tree frameworks like Cuba or Roda in mind, but works well\nwith any Rack-based framework, including Rails.\n\n## Usage\n\nFirst, build up your trail of crumbs as you match your routes:\n\n``` ruby\nCuba.plugin Migajas\n\nCuba.define do\n  breacrumbs \u003c\u003c \"Home\"\n\n  on \"users\" do\n    breadcrumbs \u003c\u003c \"Users\"\n\n    on get do\n      # render the list of users\n    end\n\n    on \":id\" do |id|\n      user = User[id]\n      breadcrumbs \u003c\u003c user.name\n\n      on get do\n        # render the user profile page\n      end\n    end\n  end\nend\n```\n\nThen, in the view, go over the `breadcrumbs` list:\n\n``` erb\n\u003col class=\"breadcrumbs\"\u003e\n  \u003c% breadcrumbs.each do |crumb| %\u003e\n    \u003cli class=\"\u003c%= \"active\" if crumb.current? %\u003e\"\u003e\n      \u003ca href=\"\u003c%= crumb.url %\u003e\"\u003e\u003c%= crumb.name %\u003e\u003c/a\u003e\n    \u003c/li\u003e\n  \u003c% end %\u003e\n\u003c/ol\u003e\n```\n\nThat's it :)\n\n## Rails\n\nStart by adding `Migajas::Rails` to your controllers:\n\n``` ruby\nclass ApplicationController \u003c ActionController::Base\n  include Migajas::Rails\nend\n```\n\nThis gives you a `breadcrumbs` method that you can access from your controllers\nand views. The recommended approach is to use action callbacks to add\nbreadcrumbs:\n\n``` ruby\nclass ApplicationController \u003c ActionController::Base\n  include Migajas::Rails\n\n  before_action { breadcrumbs.add \"Home\", root_path }\nend\n\nclass UsersController \u003c ApplicationController\n  before_action { breadcrumbs.add \"Users\", users_path }\n  before_action(only: [:show, :edit, :update]) { breadcrumbs.add @user.name, user_path(@user) }\nend\n```\n\nThen, in your layout, you can iterate over the Array:\n\n``` erb\n\u003col class=\"breadcrumbs\"\u003e\n  \u003c% breadcrumbs.each do |crumb| %\u003e\n    \u003c%= tag.li class: { active: crumb.current? } do %\u003e\n      \u003c%= link_to crumb.name, crumb.url %\u003e\n    \u003c% end %\u003e\n  \u003c% end %\u003e\n\u003c/ol\u003e\n```\n\n## Install\n\n    gem install migajas\n\n## Do we need a gem for this?\n\nProbably not, but after 2 years of using this code, I got bored of copying and\npasting it from [a gist](https://gist.github.com/foca/44c9f24a759238fba9fb).\n\n## What's in a name?\n\n`Migajas` is the Spanish word for `breadcrumbs`. It's pronounced like you'd\npronounce `me-gha-has` in English (`me` as in the word \"me\", `gha` as in\n\"ghast\", and `has` as the word \"has\".)\n\n## License\n\nThis project is shared under the MIT license. See the attached [LICENSE][] file\nfor details.\n\n[LICENSE]: ./LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoca%2Fmigajas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffoca%2Fmigajas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoca%2Fmigajas/lists"}