{"id":43128609,"url":"https://github.com/500tech/hstore_sample","last_synced_at":"2026-01-31T20:52:44.344Z","repository":{"id":22490740,"uuid":"25830095","full_name":"500tech/hstore_sample","owner":"500tech","description":"Sample Rails 4 project with Hstore","archived":false,"fork":false,"pushed_at":"2014-10-27T17:14:02.000Z","size":140,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-04-30T10:33:30.988Z","etag":null,"topics":[],"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/500tech.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}},"created_at":"2014-10-27T17:12:37.000Z","updated_at":"2015-01-29T11:59:45.000Z","dependencies_parsed_at":"2022-08-20T17:40:20.404Z","dependency_job_id":null,"html_url":"https://github.com/500tech/hstore_sample","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/500tech/hstore_sample","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/500tech%2Fhstore_sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/500tech%2Fhstore_sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/500tech%2Fhstore_sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/500tech%2Fhstore_sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/500tech","download_url":"https://codeload.github.com/500tech/hstore_sample/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/500tech%2Fhstore_sample/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28954402,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T18:30:42.805Z","status":"ssl_error","status_checked_at":"2026-01-31T18:30:19.593Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-01-31T20:52:44.118Z","updated_at":"2026-01-31T20:52:44.340Z","avatar_url":"https://github.com/500tech.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hstore with Rails 4\n\n## Installation\n\nNew rails project\n\n    rails new hstore\n\nMove to Postgres\n\nAdd ```gem \"pg\"``` to your ```Gemfile```\n\n    bundle update\n\nUpdate ```config/database.yml```\n\n    development:\n      adapter:  postgresql\n      database: hstore_test\n      username: ?\n      password: ?\n\nCreate the database\n\n    rake db:create\n\nEnable Hstore\n\n    rails g migration enable_hstore\n\nEdit the created migration file to be:\n\n    def up\n      enable_extension :hstore\n    end\n\n    def down\n      disable_extension :hstore\n    end\n\nMirate the DB\n\n    rake db:migrate\n\n\n## Create sample Model\n\nCreate Cat model\n\n    rails g model Cat name:string\n    rake db:migrate\n\nAnd a sample cat\n\n    rails c\n    \u003e Cat.create! name: 'Kipi'\n\n## Add Hstore column\n\nCreate migration\n\n    rails g migration add_data_to_cats data:hstore\n    rake db:migrate\n\nOpen up ```app/models/cat.rb```\n\n    class Cat \u003c ActiveRecord::Base\n      store_accessor :details, :family, :neutered, :age\n    end\n\nIn the console: ```rails c```\n\n    cat = Cat.first\n\n    cat.details\n    =\u003e nil\n\n    cat.details = { age: 100 }\n    =\u003e {:age=\u003e100}\n\n    cat.details = { age: 100, family: 'Aegean' }\n    =\u003e {:age=\u003e100, :family=\u003e\"Aegean\"}\n\n    cat.family\n    =\u003e \"Aegean\"\n\n## Add some validations\n\nOpen up ```app/models/cat.rb```\n\n    validates_presence_of :family\n\n## Accessing boolean\n\nHstore is all strings\n\n    def neutered\n      super == 'true' or super == true\n    end\n\n## Query\n\n    Cat.where(\"details -\u003e 'family' = ?\", 'Aegean').count\n    =\u003e 1\n\n    Cat.where(\"details -\u003e 'age' = ?\", 100)\n    =\u003e Error\n\n    Cat.where(\"details -\u003e 'age' = ?\", 100.to_s)\n    =\u003e 1\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F500tech%2Fhstore_sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F500tech%2Fhstore_sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F500tech%2Fhstore_sample/lists"}