plutonium 0.33.0 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/# Plutonium: The pre-alpha demo.md +4 -2
  3. data/.claude/skills/assets/SKILL.md +416 -0
  4. data/.claude/skills/connect-resource/SKILL.md +112 -0
  5. data/.claude/skills/controller/SKILL.md +302 -0
  6. data/.claude/skills/create-resource/SKILL.md +240 -0
  7. data/.claude/skills/definition/SKILL.md +218 -0
  8. data/.claude/skills/definition-actions/SKILL.md +386 -0
  9. data/.claude/skills/definition-fields/SKILL.md +474 -0
  10. data/.claude/skills/definition-query/SKILL.md +334 -0
  11. data/.claude/skills/forms/SKILL.md +439 -0
  12. data/.claude/skills/installation/SKILL.md +300 -0
  13. data/.claude/skills/interaction/SKILL.md +382 -0
  14. data/.claude/skills/model/SKILL.md +267 -0
  15. data/.claude/skills/model-features/SKILL.md +286 -0
  16. data/.claude/skills/nested-resources/SKILL.md +274 -0
  17. data/.claude/skills/package/SKILL.md +191 -0
  18. data/.claude/skills/policy/SKILL.md +352 -0
  19. data/.claude/skills/portal/SKILL.md +400 -0
  20. data/.claude/skills/resource/SKILL.md +281 -0
  21. data/.claude/skills/rodauth/SKILL.md +452 -0
  22. data/.claude/skills/views/SKILL.md +563 -0
  23. data/Appraisals +46 -4
  24. data/CHANGELOG.md +36 -0
  25. data/app/assets/plutonium.css +2 -2
  26. data/config/brakeman.ignore +239 -0
  27. data/config/initializers/action_policy.rb +1 -1
  28. data/docs/.vitepress/config.ts +132 -47
  29. data/docs/concepts/architecture.md +226 -0
  30. data/docs/concepts/auto-detection.md +254 -0
  31. data/docs/concepts/index.md +61 -0
  32. data/docs/concepts/packages-portals.md +304 -0
  33. data/docs/concepts/resources.md +224 -0
  34. data/docs/cookbook/blog.md +412 -0
  35. data/docs/cookbook/index.md +289 -0
  36. data/docs/cookbook/saas.md +481 -0
  37. data/docs/getting-started/index.md +56 -0
  38. data/docs/getting-started/installation.md +146 -0
  39. data/docs/getting-started/tutorial/01-setup.md +118 -0
  40. data/docs/getting-started/tutorial/02-first-resource.md +180 -0
  41. data/docs/getting-started/tutorial/03-authentication.md +246 -0
  42. data/docs/getting-started/tutorial/04-authorization.md +170 -0
  43. data/docs/getting-started/tutorial/05-custom-actions.md +202 -0
  44. data/docs/getting-started/tutorial/06-nested-resources.md +147 -0
  45. data/docs/getting-started/tutorial/07-customizing-ui.md +254 -0
  46. data/docs/getting-started/tutorial/index.md +64 -0
  47. data/docs/guides/adding-resources.md +420 -0
  48. data/docs/guides/authentication.md +551 -0
  49. data/docs/guides/authorization.md +468 -0
  50. data/docs/guides/creating-packages.md +380 -0
  51. data/docs/guides/custom-actions.md +523 -0
  52. data/docs/guides/index.md +45 -0
  53. data/docs/guides/multi-tenancy.md +302 -0
  54. data/docs/guides/nested-resources.md +411 -0
  55. data/docs/guides/search-filtering.md +266 -0
  56. data/docs/guides/theming.md +321 -0
  57. data/docs/index.md +67 -26
  58. data/docs/public/CLAUDE.md +64 -21
  59. data/docs/reference/assets/index.md +496 -0
  60. data/docs/reference/controller/index.md +363 -0
  61. data/docs/reference/definition/actions.md +400 -0
  62. data/docs/reference/definition/fields.md +350 -0
  63. data/docs/reference/definition/index.md +252 -0
  64. data/docs/reference/definition/query.md +342 -0
  65. data/docs/reference/generators/index.md +469 -0
  66. data/docs/reference/index.md +49 -0
  67. data/docs/reference/interaction/index.md +445 -0
  68. data/docs/reference/model/features.md +248 -0
  69. data/docs/reference/model/index.md +219 -0
  70. data/docs/reference/policy/index.md +385 -0
  71. data/docs/reference/portal/index.md +382 -0
  72. data/docs/reference/views/forms.md +396 -0
  73. data/docs/reference/views/index.md +479 -0
  74. data/gemfiles/rails_7.gemfile +9 -2
  75. data/gemfiles/rails_7.gemfile.lock +146 -111
  76. data/gemfiles/rails_8.0.gemfile +20 -0
  77. data/gemfiles/rails_8.0.gemfile.lock +417 -0
  78. data/gemfiles/rails_8.1.gemfile +20 -0
  79. data/gemfiles/rails_8.1.gemfile.lock +419 -0
  80. data/lib/generators/pu/gem/dotenv/templates/.env +2 -0
  81. data/lib/generators/pu/gem/dotenv/templates/config/initializers/001_ensure_required_env.rb +3 -1
  82. data/lib/generators/pu/lib/plutonium_generators/model_generator_base.rb +13 -16
  83. data/lib/generators/pu/pkg/portal/USAGE +65 -0
  84. data/lib/generators/pu/pkg/portal/portal_generator.rb +22 -9
  85. data/lib/generators/pu/res/conn/USAGE +71 -0
  86. data/lib/generators/pu/res/model/USAGE +106 -110
  87. data/lib/generators/pu/res/model/templates/model.rb.tt +6 -2
  88. data/lib/generators/pu/res/scaffold/USAGE +85 -0
  89. data/lib/generators/pu/rodauth/install_generator.rb +2 -6
  90. data/lib/generators/pu/rodauth/templates/config/initializers/url_options.rb +17 -0
  91. data/lib/generators/pu/skills/sync/USAGE +14 -0
  92. data/lib/generators/pu/skills/sync/sync_generator.rb +66 -0
  93. data/lib/plutonium/action_policy/sti_policy_lookup.rb +1 -1
  94. data/lib/plutonium/core/controller.rb +2 -2
  95. data/lib/plutonium/interaction/base.rb +1 -0
  96. data/lib/plutonium/package/engine.rb +2 -2
  97. data/lib/plutonium/query/adhoc_block.rb +6 -2
  98. data/lib/plutonium/query/model_scope.rb +1 -1
  99. data/lib/plutonium/railtie.rb +4 -0
  100. data/lib/plutonium/resource/controllers/crud_actions/index_action.rb +1 -1
  101. data/lib/plutonium/resource/controllers/crud_actions.rb +21 -18
  102. data/lib/plutonium/resource/controllers/interactive_actions.rb +21 -25
  103. data/lib/plutonium/resource/query_object.rb +38 -8
  104. data/lib/plutonium/ui/table/components/scopes_bar.rb +39 -34
  105. data/lib/plutonium/version.rb +1 -1
  106. data/lib/tasks/release.rake +19 -4
  107. data/package.json +1 -1
  108. metadata +76 -39
  109. data/brakeman.ignore +0 -28
  110. data/docs/api-examples.md +0 -49
  111. data/docs/guide/claude-code-guide.md +0 -74
  112. data/docs/guide/deep-dive/authorization.md +0 -189
  113. data/docs/guide/deep-dive/multitenancy.md +0 -256
  114. data/docs/guide/deep-dive/resources.md +0 -390
  115. data/docs/guide/getting-started/01-installation.md +0 -165
  116. data/docs/guide/index.md +0 -28
  117. data/docs/guide/introduction/01-what-is-plutonium.md +0 -211
  118. data/docs/guide/introduction/02-core-concepts.md +0 -440
  119. data/docs/guide/tutorial/01-project-setup.md +0 -75
  120. data/docs/guide/tutorial/02-creating-a-feature-package.md +0 -45
  121. data/docs/guide/tutorial/03-defining-resources.md +0 -90
  122. data/docs/guide/tutorial/04-creating-a-portal.md +0 -101
  123. data/docs/guide/tutorial/05-customizing-the-ui.md +0 -128
  124. data/docs/guide/tutorial/06-adding-custom-actions.md +0 -101
  125. data/docs/guide/tutorial/07-implementing-authorization.md +0 -90
  126. data/docs/markdown-examples.md +0 -85
  127. data/docs/modules/action.md +0 -244
  128. data/docs/modules/authentication.md +0 -236
  129. data/docs/modules/configuration.md +0 -599
  130. data/docs/modules/controller.md +0 -443
  131. data/docs/modules/core.md +0 -316
  132. data/docs/modules/definition.md +0 -1308
  133. data/docs/modules/display.md +0 -759
  134. data/docs/modules/form.md +0 -495
  135. data/docs/modules/generator.md +0 -400
  136. data/docs/modules/index.md +0 -167
  137. data/docs/modules/interaction.md +0 -642
  138. data/docs/modules/package.md +0 -151
  139. data/docs/modules/policy.md +0 -176
  140. data/docs/modules/portal.md +0 -710
  141. data/docs/modules/query.md +0 -297
  142. data/docs/modules/resource_record.md +0 -618
  143. data/docs/modules/routing.md +0 -690
  144. data/docs/modules/table.md +0 -301
  145. data/docs/modules/ui.md +0 -631
@@ -1,390 +0,0 @@
1
- # Working with Resources
2
-
3
- ::: tip What you'll learn
4
- - How to create and manage resources in Plutonium
5
- - Understanding resource definitions and configurations
6
- - Working with fields, associations, and nested resources
7
- - Implementing resource policies and scoping
8
- - Best practices for resource organization
9
- :::
10
-
11
- ## Introduction
12
-
13
- Resources are the core building blocks of a Plutonium application. A resource represents a model in your application that can be managed through a consistent interface, complete with views, controllers, and policies.
14
-
15
- ## Creating a Resource
16
-
17
- The fastest way to create a resource is using the scaffold generator:
18
-
19
- ```bash
20
- rails generate pu:res:scaffold Blog user:belongs_to \
21
- title:string content:text 'published_at:datetime?'
22
- ```
23
-
24
- This generates several files, including:
25
-
26
- ::: code-group
27
- ```ruby [app/models/blog.rb]
28
- class Blog < ResourceRecord
29
- belongs_to :user
30
- end
31
- ```
32
-
33
- ```ruby [app/policies/blog_policy.rb]
34
- class BlogPolicy < Plutonium::Resource::Policy
35
- def create?
36
- true
37
- end
38
-
39
- def read?
40
- true
41
- end
42
-
43
- def permitted_attributes_for_create
44
- %i[user title content published_at]
45
- end
46
-
47
- def permitted_attributes_for_read
48
- %i[user title content published_at]
49
- end
50
- end
51
- ```
52
-
53
- ```ruby [app/definitions/blog_definition.rb]
54
- class BlogDefinition < Plutonium::Resource::Definition
55
- end
56
- ```
57
- :::
58
-
59
- ## Resource Definitions
60
-
61
- Resource definitions customize how a resource behaves in your application. They define:
62
- - Fields and their types
63
- - Available actions
64
- - Search and filtering capabilities
65
- - Sorting options
66
- - Display configurations
67
-
68
- ### Basic Field Configuration
69
-
70
- ::: code-group
71
- ```ruby [Simple Fields]
72
- class BlogDefinition < Plutonium::Resource::Definition
73
- # Basic field definitions
74
- field :content, as: :text
75
-
76
- # Field with custom display options
77
- field :published_at,
78
- as: :datetime,
79
- hint: "When this post should be published"
80
- end
81
- ```
82
-
83
- ```ruby [Custom Displays]
84
- class BlogDefinition < Plutonium::Resource::Definition
85
- # Customize how fields are displayed
86
- display :title, wrapper: {class: "col-span-full"}
87
- display :content, wrapper: {class: "col-span-full"} do |f|
88
- f.text_tag class: "format dark:format-invert"
89
- end
90
-
91
- # Custom column display in tables
92
- column :published_at, align: :end
93
- end
94
- ```
95
- :::
96
-
97
- <!--
98
- ### Working with Associations
99
-
100
- Plutonium makes it easy to work with Rails associations:
101
-
102
- ```ruby
103
- class BlogDefinition < Plutonium::Resource::Definition
104
- # Define belongs_to association
105
- field :user, as: :belongs_to
106
-
107
- # Has-many association with inline creation
108
- field :comments do |f|
109
- f.has_many_tag nested: true
110
- end
111
-
112
- # Configure nested attributes
113
- define_nested_input :comments,
114
- inputs: %i[content user],
115
- limit: 3 do |input|
116
- input.define_field_input :content,
117
- type: :text,
118
- hint: "Keep it constructive"
119
- end
120
- end
121
- ```
122
- -->
123
-
124
- ### Adding Custom Actions
125
-
126
- Beyond CRUD, you can add custom actions to your resources:
127
-
128
- ```ruby
129
- # app/interactions/blogs/publish.rb
130
- module Blogs
131
- class Publish < Plutonium::Resource::Interaction
132
- # Define what this interaction accepts
133
- attribute :resource, class: Blog
134
- attribute :publish_date, :date, default: -> { Time.current }
135
-
136
- presents label: "Publish Blog",
137
- icon: Phlex::TablerIcons::Send,
138
- description: "Make this blog post public"
139
-
140
- private
141
-
142
- def execute
143
- if resource.update(
144
- published_at: publish_date
145
- )
146
- succeed(resource)
147
- .with_message("Blog post published successfully")
148
- .with_redirect_response(resource)
149
- else
150
- failed(resource.errors)
151
- end
152
- end
153
- end
154
- end
155
-
156
- # app/definitions/blog_definition.rb
157
- class BlogDefinition < Plutonium::Resource::Definition
158
- # Register the custom action
159
- action :publish,
160
- interaction: Blogs::Publish,
161
- category: :primary
162
- end
163
- ```
164
-
165
- ### Search and Filtering
166
-
167
- Add search and filtering capabilities to your resources:
168
-
169
- ```ruby
170
- class BlogDefinition < Plutonium::Resource::Definition
171
- # Enable full-text search
172
- search do |scope, query|
173
- scope.where("title ILIKE ? OR content ILIKE ?",
174
- "%#{query}%", "%#{query}%")
175
- end
176
-
177
- # Add filters
178
- filter :published_at,
179
- with: DateFilter,
180
- predicate: :gteq
181
-
182
- # Add scopes
183
- scope :published do |scope|
184
- scope.where.not(published_at: nil)
185
- end
186
- scope :draft do |scope|
187
- scope.where(published_at: nil)
188
- end
189
-
190
- # Configure sorting
191
- sort :title
192
- sort :published_at
193
-
194
- # Configure default sorting (newest first)
195
- default_sort :published_at, :desc
196
- end
197
- ```
198
-
199
- ## Resource Policies
200
-
201
- Policies control access to your resources:
202
-
203
- ```ruby
204
- class BlogPolicy < Plutonium::Resource::Policy
205
- def permitted_attributes_for_create
206
- %i[title content state published_at user_id]
207
- end
208
-
209
- def permitted_associations
210
- %i[comments]
211
- end
212
-
213
- def create?
214
- # Allow logged in users to create blogs
215
- user.present?
216
- end
217
-
218
- def update?
219
- # Users can only edit their own blogs
220
- record.user_id == user.id
221
- end
222
-
223
- def publish?
224
- # Only editors can publish
225
- user.editor? && record.draft?
226
- end
227
-
228
- # Scope visible records
229
- relation_scope do |relation|
230
- relation = super(relation)
231
- next relation unless user.admin?
232
-
233
- relation.with_deleted
234
- end
235
- end
236
- ```
237
-
238
- ## Best Practices
239
-
240
- ::: tip Resource Organization
241
- 1. Keep resource definitions focused and cohesive
242
- 2. Use packages to organize related resources
243
- 3. Leverage policy scopes for authorization
244
- 4. Extract complex logic into interactions
245
- 5. Use presenters for view-specific logic
246
- :::
247
-
248
- ::: warning Common Pitfalls
249
- - Avoid putting business logic in definitions
250
- - Don't bypass policy checks
251
- - Remember to scope resources appropriately
252
- - Test your interactions and policies
253
- :::
254
-
255
- # Deep Dive: Building a Resource
256
-
257
- In Plutonium, a **Resource** is the central concept for managing your application's data. It's more than just a model—it's a complete package that includes the model, controller, policy, views, and all the configuration that ties them together.
258
-
259
- This guide will walk you through building a complete `Post` resource from scratch, demonstrating how Plutonium's different modules work together to create a powerful and consistent user experience.
260
-
261
- ## 1. Generating the Resource
262
-
263
- We'll start with the scaffold generator, which creates all the necessary files for our `Post` resource.
264
-
265
- ```bash
266
- rails generate pu:res:scaffold Post user:belongs_to title:string content:text published_at:datetime
267
- ```
268
-
269
- This command generates:
270
- - A `Post` model with the specified attributes and a `belongs_to :user` association.
271
- - A `PostsController`.
272
- - A `PostPolicy` with basic permissions.
273
- - A `PostDefinition` file, which will be the focus of this guide.
274
-
275
- ## 2. Configuring Display & Forms (The Definition File)
276
-
277
- The **Definition** file (`app/definitions/post_definition.rb`) is where you declaratively configure how your resource is displayed and edited. Let's start by defining the fields for our table, detail page, and form.
278
-
279
- ::: code-group
280
- ```ruby [app/definitions/post_definition.rb]
281
- class PostDefinition < Plutonium::Resource::Definition
282
- # Configure the table (index view)
283
- column :user, label: "Author"
284
- column :published_at, as: :datetime
285
-
286
- # Configure the detail page (show view)
287
- display :user, label: "Author"
288
- display :published_at, as: :datetime
289
- display :content, as: :rich_text
290
-
291
- # Configure the form (new/edit views)
292
- input :user, as: :select, label: "Author" # Explicitly use a select input
293
- input :content, as: :rich_text
294
- end
295
- ```
296
- ```ruby [app/policies/post_policy.rb]
297
- # In the policy, we must permit these attributes to be read and written.
298
- class PostPolicy < Plutonium::Resource::Policy
299
- # ...
300
-
301
- def permitted_attributes_for_read
302
- [:title, :user, :published_at, :content]
303
- end
304
-
305
- def permitted_attributes_for_create
306
- [:title, :user_id, :content]
307
- end
308
-
309
- def permitted_attributes_for_update
310
- permitted_attributes_for_create
311
- end
312
- end
313
- ```
314
- :::
315
-
316
- Here, we've used the `display` helper to control the `index` and `show` views, and the `input` helper for the forms. We've also specified `:rich_text` to get a WYSIWYG editor for our content. Notice that we also had to permit these attributes in the policy.
317
-
318
- ## 3. Adding a Custom Action
319
-
320
- Standard CRUD is great, but most applications have custom business logic. Let's add a "Publish" action. This involves creating an **Interaction** for the logic and registering it in the definition.
321
-
322
- ::: code-group
323
- ```ruby [app/interactions/post_interactions/publish.rb]
324
- module PostInteractions
325
- class Publish < Plutonium::Resource::Interaction
326
- attribute :resource, class: "Post"
327
-
328
- private
329
-
330
- def execute
331
- resource.update(published_at: Time.current)
332
- succeed(resource).with_message("Post was successfully published.")
333
- end
334
- end
335
- end
336
- ```
337
- ```ruby [app/definitions/post_definition.rb]
338
- class PostDefinition < Plutonium::Resource::Definition
339
- # ... (display and input helpers)
340
-
341
- action :publish,
342
- interaction: "PostInteractions::Publish",
343
- category: :primary
344
- end
345
- ```
346
- ```ruby [app/policies/post_policy.rb]
347
- class PostPolicy < Plutonium::Resource::Policy
348
- # ... (attribute permissions)
349
-
350
- # An action is only visible if its policy returns true.
351
- def publish?
352
- # Only show the publish button if the post is not yet published.
353
- update? && record.published_at.nil?
354
- end
355
- end
356
- ```
357
- :::
358
-
359
- We now have a "Publish" button on our `Post` detail page that only appears when appropriate, thanks to the combination of the Interaction, Definition, and Policy.
360
-
361
- ## 4. Configuring Search, Filters, and Sorting
362
-
363
- To make our resource table more useful, let's add search, filtering, and sorting capabilities. This is all handled declaratively in the definition file.
364
-
365
- ```ruby
366
- # app/definitions/post_definition.rb
367
- class PostDefinition < Plutonium::Resource::Definition
368
- # ... (display, input, and action helpers)
369
-
370
- # Enable full-text search across title and content
371
- search do |scope, query|
372
- scope.where("title ILIKE :q OR content ILIKE :q", q: "%#{query}%")
373
- end
374
-
375
- # Add filters to the sidebar
376
- filter :published, with: ->(scope, value) { value ? scope.where.not(published_at: nil) : scope.where(published_at: nil) }, as: :boolean
377
- filter :user, as: :select, choices: User.pluck(:name, :id)
378
-
379
- # Define named scopes that appear as buttons
380
- scope :all
381
- scope :published, -> { where.not(published_at: nil) }
382
- scope :drafts, -> { where(published_at: nil) }
383
-
384
- # Configure which columns are sortable
385
- sort :title
386
- sort :published_at
387
- end
388
- ```
389
-
390
- With just a few lines of code, we now have a powerful and interactive table view for our posts, complete with a search bar, filter sidebar, scope buttons, and sortable columns. This demonstrates how the **Resource** module integrates seamlessly with the **Query** module.
@@ -1,165 +0,0 @@
1
- # Installation and Setup
2
-
3
- ::: tip VERSION REQUIREMENTS
4
- - Ruby 3.2.2 or higher
5
- - Rails 7.1 or higher
6
- - Node.js and Yarn
7
- :::
8
-
9
- ## Quick Start
10
-
11
- Get up and running with Plutonium in seconds:
12
-
13
- ::: code-group
14
- ```bash [New App]
15
- rails new plutonium_app -a propshaft -j esbuild -c tailwind \
16
- -m https://radioactive-labs.github.io/plutonium-core/templates/plutonium.rb
17
- ```
18
-
19
- ```bash [Existing App]
20
- bin/rails app:template \
21
- LOCATION=https://radioactive-labs.github.io/plutonium-core/templates/base.rb
22
- ```
23
- :::
24
-
25
- ## Detailed Installation Guide
26
-
27
- 1. Add Plutonium to your Gemfile:
28
-
29
- ::: code-group
30
- ```ruby [Gemfile]
31
- gem "plutonium"
32
- ```
33
-
34
- ```bash [Terminal]
35
- bundle install
36
- ```
37
- :::
38
-
39
- 2. Run the installation generator:
40
-
41
- ```bash
42
- rails generate pu:core:install
43
- ```
44
-
45
- This will:
46
- - Set up the basic Plutonium structure
47
- - Create necessary configuration files
48
- - Configure your application for Plutonium
49
-
50
- ### Project Structure
51
-
52
- After installation, your project will have the following new directories and files:
53
-
54
- ```
55
- my_rails_app/
56
- ├── app/
57
- │ ├── controllers/
58
- │ │ ├── plutonium_controller.rb # Base controller for Plutonium
59
- │ │ └── resource_controller.rb # Base controller for resources
60
- │ ├── definitions/
61
- │ │ └── resource_definition.rb # Base class for resource definitions
62
- │ ├── interactions/
63
- │ │ └── resource_interaction.rb # Base class for resource interactions
64
- │ ├── models/
65
- │ │ └── resource_record.rb # Base module for resource models
66
- │ ├── policies/
67
- │ │ └── resource_policy.rb # Base class for resource policies
68
- │ └── views/
69
- │ └── layouts/
70
- │ └── resource.html.erb # Base layout for resources
71
- ├── config/
72
- │ ├── initializers/
73
- │ │ └── plutonium.rb # Main configuration
74
- │ └── packages.rb # Package registration
75
- └── packages/ # Directory for modular features
76
- └── .keep
77
- ```
78
-
79
- ## Configuration
80
-
81
- ### Basic Configuration
82
-
83
- Configure Plutonium in `config/initializers/plutonium.rb`:
84
-
85
- ```ruby
86
- Plutonium.configure do |config|
87
- # Load default configuration for version 1.0
88
- config.load_defaults 1.0
89
-
90
- # Asset configuration
91
- config.assets.stylesheet = "plutonium.css" # Default stylesheet
92
- config.assets.script = "plutonium.js" # Default JavaScript
93
- config.assets.logo = "plutonium.png" # Default logo
94
- end
95
- ```
96
-
97
- ### Authentication Setup
98
-
99
- Plutonium supports multiple authentication strategies. Here's how to set up the recommended Rodauth integration:
100
-
101
- 1. Install Rodauth:
102
-
103
- ```bash
104
- rails generate pu:rodauth:install
105
- ```
106
-
107
- 2. Create an authentication account:
108
-
109
- ::: code-group
110
- ```bash [Basic Setup]
111
- rails generate pu:rodauth:account user
112
- ```
113
-
114
- ```bash [Custom Setup]
115
- # Include selected authentication features
116
- rails generate pu:rodauth:account admin --no-defaults \
117
- --login --logout --remember --lockout \
118
- --create-account --verify-account --close-account \
119
- --change-password --reset-password --reset-password-notify \
120
- --active-sessions --password-grace-period --otp \
121
- --recovery-codes --audit-logging --internal-request
122
- ```
123
- :::
124
-
125
- 3. Configure the authentication controller:
126
-
127
- ```ruby
128
- # app/controllers/resource_controller.rb
129
- class ResourceController < PlutoniumController
130
- include Plutonium::Resource::Controller
131
- include Plutonium::Auth::Rodauth(:user)
132
- end
133
- ```
134
-
135
- ::: tip
136
- You can use your existing authentication system by implementing the `current_user` method in `ResourceController`.
137
- :::
138
-
139
- ## Optional Enhancements
140
-
141
- ### Database Performance
142
-
143
- For PostgreSQL/MySQL users, add these recommended gems:
144
-
145
- ```ruby
146
- group :development, :test do
147
- # N+1 query detection
148
- gem "prosopite"
149
- end
150
-
151
- # Automatic eager loading
152
- gem "goldiloader"
153
- ```
154
-
155
- ### Development Tools
156
-
157
- Add helpful development gems:
158
-
159
- ```ruby
160
- # Generate model annotations
161
- rails generate pu:gem:annotated
162
-
163
- # Set up environment variables
164
- rails generate pu:gem:dotenv
165
- ```
data/docs/guide/index.md DELETED
@@ -1,28 +0,0 @@
1
- ---
2
- layout: home
3
- title: Plutonium Documentation
4
- hero:
5
- name: Plutonium Documentation
6
- text: A RAD toolkit for Rails
7
- tagline: Build better applications, faster.
8
- actions:
9
- - theme: brand
10
- text: Get Started
11
- link: /guide/introduction/01-what-is-plutonium
12
- - theme: alt
13
- text: View on GitHub
14
- link: https://github.com/radioactive-labs/plutonium
15
- features:
16
- - title: Introduction
17
- details: Learn about the core concepts and architecture of Plutonium.
18
- link: /guide/introduction/01-what-is-plutonium
19
- - title: Tutorial
20
- details: A step-by-step guide to building your first application.
21
- link: /guide/tutorial/01-project-setup
22
- - title: Deep Dive Guides
23
- details: In-depth explanations of specific Plutonium features.
24
- link: /guide/deep-dive/resources
25
- - title: Module Documentation
26
- details: Detailed documentation for each Plutonium module.
27
- link: /modules/
28
- ---