plutonium-connect-resource
Connect existing resources to portals for web access
Installation
Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.
View source ↗GuidesSkill instructions
Connect Resource Skill
Use the pu:res:conn generator to connect resources to portals. This is required to expose resources through a portal's web interface.
Command Syntax
rails g pu:res:conn RESOURCE [RESOURCE...] --dest=PORTAL_NAME
Always specify resources directly - this avoids interactive prompts. The --src option is only needed for interactive mode and can be ignored.
Usage Patterns
Main App Resources (not in a package)
rails g pu:res:conn PropertyAmenity --dest=admin_portal
rails g pu:res:conn Post Comment Tag --dest=dashboard_portal
Namespaced Resources (from a feature package)
Use the full class name:
rails g pu:res:conn Blogging::Post --dest=admin_portal
rails g pu:res:conn Blogging::Post Blogging::Comment --dest=admin_portal
Multiple Resources at Once
rails g pu:res:conn Property PropertyAmenity Unit Tenant --dest=admin_portal
What Gets Generated
For a resource Post connected to admin_portal:
packages/admin_portal/
├── app/
│ ├── controllers/admin_portal/
│ │ └── posts_controller.rb # Portal controller
│ ├── policies/admin_portal/
│ │ └── post_policy.rb # Portal policy (if needed)
│ └── definitions/admin_portal/
│ └── post_definition.rb # Portal definition (if needed)
└── config/
└── routes.rb # Updated with register_resource
Generated Controller
class AdminPortal::PostsController < ::PostsController
include AdminPortal::Concerns::Controller
end
Generated Policy
class AdminPortal::PostPolicy < ::PostPolicy
include AdminPortal::ResourcePolicy
def permitted_attributes_for_create
[:title, :content, :user_id]
end
def permitted_attributes_for_read
[:title, :content, :user_id, :created_at, :updated_at]
end
def permitted_associations
%i[]
end
end
Route Registration
# In packages/admin_portal/config/routes.rb
register_resource ::Post
Typical Workflow
# 1. Create resources (always specify --dest)
rails g pu:res:scaffold Post user:belongs_to title:string 'content:text?' --dest=main_app
# 2. Run migrations
rails db:migrate
# 3. Connect resources to portal (always specify --dest)
rails g pu:res:conn Post --dest=admin_portal
Important Notes
-
Always specify resources directly - avoids prompts, no
--srcneeded - Always use the generator - never manually connect resources
- Run after migrations - the generator reads model columns for policy attributes
- Portal-specific customization - customize the generated policy/definition per-portal
Examples
Read the usage examples in the source repository.
View source ↗Source history
- Indexed on
- 2026-01-20
- Index updated
- 2026-01-26
- Branch
- main
Index and sync dates describe this directory. View the source repository for code history.
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!