diff --git a/doc/admin.md b/doc/admin.md index 905f684..224f42c 100644 --- a/doc/admin.md +++ b/doc/admin.md @@ -13,6 +13,11 @@ view of any object that has blocks attached. <%= render 'no_cms/admin/blocks/blocks/index', f: f %> ``` +To use it you will need to add two methods to your controller's helper: + +* **block_form_classes**: receives a block and returns an array of classes that will be used in the block's admin layout +* **block_form_id**: receives a block and returns the id assigned to the block's admoin layout in the HTML. + ### Block admin templates Same way that a block has a partial that gets rendered in the public views it diff --git a/doc/models.md b/doc/models.md index a5496d9..4ea79b1 100644 --- a/doc/models.md +++ b/doc/models.md @@ -26,7 +26,16 @@ And creating the relationship in your model: ```ruby class Page - has_many :blocks, class_name: "NoCms::Blocks::Block + has_many :blocks, class_name: "NoCms::Blocks::Block" +end +``` + +Also, if you plan to use `fields_for` to manage your blocks from your model's edit form (or you are going to use the admin helper provided by this gem) you are going to need to accept nested attributes by adding: + +```ruby +class Page + has_many :blocks, class_name: "NoCms::Blocks::Block" + accepts_nested_attributes_for :blocks end ```