{"id":18586276,"url":"https://github.com/testdouble/transparam","last_synced_at":"2025-05-16T06:33:51.848Z","repository":{"id":91782470,"uuid":"237662143","full_name":"testdouble/transparam","owner":"testdouble","description":null,"archived":false,"fork":false,"pushed_at":"2022-03-25T18:12:02.000Z","size":34,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-02-17T17:56:03.468Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/testdouble.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2020-02-01T18:55:55.000Z","updated_at":"2024-04-29T20:19:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"16a00fa7-fab8-494b-940c-4d3dcde3c881","html_url":"https://github.com/testdouble/transparam","commit_stats":null,"previous_names":["testdouble/transparam"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/testdouble%2Ftransparam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/testdouble%2Ftransparam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/testdouble%2Ftransparam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/testdouble%2Ftransparam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/testdouble","download_url":"https://codeload.github.com/testdouble/transparam/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254484409,"owners_count":22078754,"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":"2024-11-07T00:37:36.835Z","updated_at":"2025-05-16T06:33:51.803Z","avatar_url":"https://github.com/testdouble.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Transparam\n\n\u003e :warning: **Alpha quality**: While Transparam has been used at Hint for a couple of years now, it should be considered alpha quality. Your mileage may vary! Also, please see the [Known issues](#known-issues) below for a list of shortcomings (contribution opportunities…?).\n\nTransparam assists in the process of migrating a rails application from `protected_attributes` to `strong_parameters`. Transparam makes some assumptions about how strong parameters should be implemented in your application. To learn more, checkout this [blog post](https://hint.io/blog/strong-parameters-strong-opinions).\n\nFor example, the User model defined here:\n\n```ruby\nclass User \u003c ActiveRecord::Base\n  attr_accessible :email, :phone_numbers_attributes\n\n  has_many :phone_numbers\n\n  accepts_nested_attributes_for :phone_numbers, update_only: true, allow_destroy: true\nend\n\nclass PhoneNumber \u003c ActiveRecord::Base\n  attr_accessible :number\n\n  belongs_to :users\nend\n```\n\nWill result in this strong parameters concern:\n\n```ruby\n# app/controllers/concerns/strong_parameters/user.rb\nmodule Concerns\n  module StrongParameters\n    module User\n      def user_params\n        params.require(:user).moderate(controller_name, action_name, *Concerns::StrongParameters::User.permitted_attrs)\n      end\n\n      def self.permitted_attrs\n        [\n          :email,\n          { :phone_numbers_attributes =\u003e [:_destroy, *Concerns::StrongParameters::PhoneNumber.permitted_attrs] }\n        ]\n      end\n    end\n  end\nend\n```\n\n## Usage\n\nFrom the root of the target rails application run the generate command:\n\n`transparam generate`\n\nTransparam performs dynamic analysis and thus requires a working development environment.\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Known issues\n\n- `attr_protected` is not yet supported.\n- Multiple roles are not yet supported (example `as: :admin`).\n- Only [moderate_parameters](https://github.com/hintmedia/moderate_parameters) is supported (`.permit` vs `.moderate`). Ideally this would be configurable.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/hintmedia/transparam. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/hintmedia/transparam/blob/master/CODE_OF_CONDUCT.md).\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the Transparam project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/hintmedia/transparam/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftestdouble%2Ftransparam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftestdouble%2Ftransparam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftestdouble%2Ftransparam/lists"}