README.md in chosen_template-0.0.1 vs README.md in chosen_template-0.1.0
- old
+ new
@@ -18,10 +18,12 @@
$ gem install chosen_template
## Usage
+### Models
+
The item that can be preview and published:
class PageTemplate < ActiveRecord::Base
belongs_to :page
choosable_template by: :page
@@ -62,15 +64,38 @@
- `published_templates` returns templates that were ever published
- `previewed_templates` returns templates that were ever previewed
- `by_template_published_at` returns templates ordered by the date they were published, from most newest to oldest
- `by_template_previewed_at` returns templates ordered by the date they were previewed, from most newest to oldest
+### Controllers
+
+If you want to have specific actions on your controllers to preview and publish, do the following:
+
+ class PageTemplateController < ApplicationController
+ choosable_templates
+ end
+
+That gives you the following actions:
+
+- PUT #preview_template
+- PUT #publish_template
+
+Remember, to get this to work you still have to add the route:
+
+ resources :page_templates do
+ member do
+ put :preview_template
+ put :publish_template
+ end
+ end
+
## Running Specs
In the root folder:
bundle install
- rake db:migrate DB=test
+ cd spec/dummy
+ rake db:migrate db:test:prepare
rspec spec
## Contributing
1. Fork it