https://github.com/benignware/scaffold_assoc
Scaffold nested resources with Rails
https://github.com/benignware/scaffold_assoc
Last synced: 11 months ago
JSON representation
Scaffold nested resources with Rails
- Host: GitHub
- URL: https://github.com/benignware/scaffold_assoc
- Owner: benignware
- License: mit
- Created: 2014-02-18T14:57:06.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2015-04-08T18:14:49.000Z (about 11 years ago)
- Last Synced: 2023-08-12T18:37:46.783Z (almost 3 years ago)
- Language: Ruby
- Homepage:
- Size: 285 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
scaffold_assoc
==============
> Scaffold nested resources with Rails
Install
-------
```
# Gemfile
gem "scaffold_assoc"
```
Usage
-----
Generate parent scaffold:
```
rails g scaffold Post title:string content:text
```
Generate association scaffold:
```
rails g scaffold_assoc Post/Comment title:string content:text
```
Hit `rake routes` to inspect nested resource routes.
Since scaffold_assoc only handles the association side of a model, you will have to add an has_many-relation to the parent model as well:
```ruby
# app/models/post.rb
class Post < ActiveRecord::Base
has_many :comments
end
```
Customize views
---------------
The plugin ships with .erb and .haml-templates.
Install view templates to lib/rails/scaffold_assoc/templates:
```
rails g scaffold_assoc:install
```