{"id":26162539,"url":"https://github.com/carmen-ruby/carmen-rails","last_synced_at":"2025-04-05T16:08:12.915Z","repository":{"id":2811903,"uuid":"3813192","full_name":"carmen-ruby/carmen-rails","owner":"carmen-ruby","description":"NOT ACTIVELY MAINTAINED Rails adapter for Carmen (provides country_select and subregion_select)","archived":false,"fork":false,"pushed_at":"2024-04-22T08:24:40.000Z","size":379,"stargazers_count":215,"open_issues_count":30,"forks_count":159,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-09-17T06:55:30.749Z","etag":null,"topics":[],"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/carmen-ruby.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"MIT-LICENSE","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":"2012-03-23T22:26:06.000Z","updated_at":"2024-05-29T09:19:54.000Z","dependencies_parsed_at":"2024-06-18T14:10:40.908Z","dependency_job_id":null,"html_url":"https://github.com/carmen-ruby/carmen-rails","commit_stats":{"total_commits":55,"total_committers":11,"mean_commits":5.0,"dds":0.3090909090909091,"last_synced_commit":"50ebda9ac696306abdfc6ebd75af06cd79de2ded"},"previous_names":["jim/carmen-rails"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carmen-ruby%2Fcarmen-rails","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carmen-ruby%2Fcarmen-rails/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carmen-ruby%2Fcarmen-rails/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carmen-ruby%2Fcarmen-rails/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/carmen-ruby","download_url":"https://codeload.github.com/carmen-ruby/carmen-rails/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247361689,"owners_count":20926643,"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":[],"created_at":"2025-03-11T13:55:10.054Z","updated_at":"2025-04-05T16:08:12.898Z","avatar_url":"https://github.com/carmen-ruby.png","language":"Ruby","readme":"# NOT ACTIVELY MAINTAINED\n\nI haven't time in over a year to properly support this project.\n\n# carmen-rails\n\ncarmen-rails is a Rails 3 plugin that supplies two new form helper methods:\n`country_select` and `subregion_select`. It uses\n[carmen](http://github.com/jim/carmen) as its source of geographic data.\n\n## Requirements\n\ncarmen-rails requires Ruby 1.9.2 or greater.\n\n## Installation\n\nJust add carmen-rails to your Gemfile:\n\n```ruby\ngem 'carmen-rails', '~\u003e 1.0.0'\n```\n## Usage\n\n```erb\n\u003c%= form_for(@order) do |f| %\u003e\n  \u003cdiv class=\"field\"\u003e\n    \u003c%= f.label :country_code %\u003e\u003cbr /\u003e\n    \u003c%= f.country_select :country_code, {priority: %w(US CA), prompt: 'Please select a country'} %\u003e\n  \u003c/div\u003e\n\u003c% end %\u003e\n```\n\n#### SimpleForm\nPass the object to the country_select helper. This ensures the persisted country is selected when the form is rendered. \n\n```erb\n\u003c%= simple_form_for @user do |f| %\u003e\n  \u003c%= f.input :country_code do %\u003e\n    \u003c%= f.country_select :country_code, {object: f.object, prompt: 'Country'} %\u003e\n  \u003c% end %\u003e\n\u003c% end %\u003e\n```\n\nPassing the object is necessary when using nested form fields with Formtastic.\n\n## How do I only display a subset of countries/regions?\n\nCarmen had a concept of excluded countries in the old days, where you could\nspecify certain countries or regions to not include in a select.\n\nThe new (and much more flexible) way to handle this is to write a helper method\nthat returns the subset of regions you want to provide:\n\n``` ruby\ndef only_us_and_canada\n  Carmen::Country.all.select{|c| %w{US CA}.include?(c.code)}\nend\n```\n\nAnd then in your form something like this:\n\n``` erb\n\u003c%= f.select :country, region_options_for_select(only_us_and_canada) %\u003e\n```\n\nMore docs coming soon. In the meantime, all of the public methods in\ncarmen-rails [have been thoroughly TomDoc'ed](https://github.com/jim/carmen-rails/blob/master/lib/carmen/rails/action_view/form_helper.rb).\n\n### Demo app\n\nThere is a [live demo app](http://carmen-rails-demo.herokuapp.com) that shows\ncarmen-rails in action, and includes a [step-by-step setup guide](https://github.com/jim/carmen-demo-app#readme).\n\n## Configuration\n\nUsing this library will automatically set Carmen to use [Rails' built-in I18n functionality](http://guides.rubyonrails.org/i18n.html). This means that changing\nsome configuration should be done through Rails and not Carmen. For example, adding paths for additional locale files\nshould be done inside `config/application.rb`:\n\n``` ruby\nconfig.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarmen-ruby%2Fcarmen-rails","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcarmen-ruby%2Fcarmen-rails","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarmen-ruby%2Fcarmen-rails/lists"}