{"id":15612056,"url":"https://github.com/serradura/rails-components","last_synced_at":"2026-04-19T02:09:14.303Z","repository":{"id":138272734,"uuid":"123381694","full_name":"serradura/rails-components","owner":"serradura","description":null,"archived":false,"fork":false,"pushed_at":"2018-07-20T16:34:10.000Z","size":35,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-29T15:12:28.678Z","etag":null,"topics":["components","frontend-components","functional-programming-principles","rails","ruby","ruby-on-rails"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/serradura.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-01T04:23:03.000Z","updated_at":"2021-03-05T21:33:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"846fb0cd-6499-4225-96e0-4b42ae84654d","html_url":"https://github.com/serradura/rails-components","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/serradura/rails-components","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serradura%2Frails-components","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serradura%2Frails-components/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serradura%2Frails-components/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serradura%2Frails-components/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serradura","download_url":"https://codeload.github.com/serradura/rails-components/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serradura%2Frails-components/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31991721,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["components","frontend-components","functional-programming-principles","rails","ruby","ruby-on-rails"],"created_at":"2024-10-03T06:21:42.224Z","updated_at":"2026-04-19T02:09:14.265Z","avatar_url":"https://github.com/serradura.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"Component-Based Rails App\n=========================\n\nTest the below examples in `app/blogs/index.html.erb`.\n\n**#1 PORO helper components**\n\n```erb\n\u003ctbody\u003e\n  \u003c%= safe_join @blogs.map(\u0026method(:blogs_table_row)) %\u003e\n\u003c/tbody\u003e\n```\n\n```erb\n\u003ctbody\u003e\n  \u003c% @blogs.each do |blog| %\u003e\n    \u003c%= blogs_table_row(blog) %\u003e\n  \u003c% end %\u003e\n\u003c/tbody\u003e\n```\n\n```erb\n\u003ctbody\u003e\n  \u003c% @blogs.each_with_index do |blog, index| %\u003e\n    \u003c%=\n      blogs_table_row blog, -\u003e do\n        content_tag(:strong, \"Ahoy #{'!' * (index+1)}\")\n      end\n    %\u003e\n  \u003c% end %\u003e\n\u003c/tbody\u003e\n```\n\n**#2 Rails partial components**\n\n```erb\n\u003ctbody\u003e\n  \u003c% @blogs.each do |blog| %\u003e\n    \u003c%= component(:row, blog: blog) %\u003e\n  \u003c% end %\u003e\n\u003c/tbody\u003e\n```\n\n```erb\n\u003ctbody\u003e\n  \u003c% @blogs.each_with_index do |blog, index| %\u003e\n    \u003c%= component(:row, blog: blog) do %\u003e\n      \u003cstrong\u003eAhoy\u003c%= '!' * (index+1) %\u003e\u003c/strong\u003e\n    \u003c% end %\u003e\n  \u003c% end %\u003e\n\u003c/tbody\u003e\n```\n\nExtras:\n-------\n\nTest the following snippets in `rails console`:\n\n```ruby\ntags = Components::Tags.new(helper)\n\ntags.br\n#=\u003e \"\u003cbr /\u003e\"\n\ntags.br style: 'margin-top: 10px'\n#=\u003e \"\u003cbr style=\\\"margin-top: 10px\\\" /\u003e\"\n\ntags.ul\n#=\u003e \"\u003cul\u003e\u003c/ul\u003e\"\n\ntags.ul [1,2,3].map \u0026tags.method(:li)\n#=\u003e \"\u003cul\u003e\u003cli\u003e1\u003c/li\u003e\u003cli\u003e2\u003c/li\u003e\u003cli\u003e3\u003c/li\u003e\u003c/ul\u003e\"\n```\n\nRelated resources:\n------------------\n* https://www.innoq.com/en/blog/rails-frontend-components\n* https://goiabada.blog/rails-components-faedd412ce19\n* https://www.igvita.com/2007/03/15/block-helpers-and-dry-views-in-rails/\n* http://blog.plataformatec.com.br/2011/04/default-views-in-rails-3-0-with-custom-resolvers/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserradura%2Frails-components","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserradura%2Frails-components","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserradura%2Frails-components/lists"}