Module: PropelApi
- Defined in:
- lib/generators/propel_api/core/base.rb,
lib/propel_api.rb,
lib/generators/propel_api/core/named_base.rb,
lib/generators/propel_api/unpack/unpack_generator.rb,
lib/generators/propel_api/install/install_generator.rb,
lib/generators/propel_api/core/configuration_methods.rb,
lib/generators/propel_api/resource/resource_generator.rb,
lib/generators/propel_api/core/path_generation_methods.rb,
lib/generators/propel_api/controller/controller_generator.rb
Overview
PropelApi controller generator that creates API controllers, routes, and tests for existing models
Usage:
rails generate propel_api:controller User # Auto-introspect (with warning)
rails generate propel_api:controller User --all-attributes # Auto-introspect (explicit)
rails generate propel_api:controller User name:string # Use specified attributes
rails generate propel_api:controller User --namespace=admin_api --version=v2
Attribute Detection Priority:
1. --all-attributes flag
Configurable Security Filtering:
Filtering is controlled by PropelApi.attribute_filter in config/initializers/propel_api.rb
- Sensitive patterns: passwords, tokens, keys, SSNs, etc.
- Excluded patterns: , Rails internals, binary data
- Large content patterns: descriptions, content, body text, etc.
Customize for your project's naming conventions:
PropelApi.attribute_filter.add_sensitive_pattern(/private_.*/)
PropelApi.attribute_filter.add_excluded_pattern(/legacy_.*/)
View current patterns: PropelApi.attribute_filter.filtering_summary
This generator assumes the model already exists and creates:
-
API controller with full CRUD operations
-
Routes with proper namespacing
-
Controller tests
-
Integration tests
Defined Under Namespace
Modules: ConfigurationMethods, PathGenerationMethods Classes: Base, ControllerGenerator, InstallGenerator, NamedBase, ResourceGenerator, UnpackGenerator
Constant Summary collapse
- VERSION =
"0.3.4"