Skip to content

Commit

Permalink
Better readme and rails 3 routing
Browse files Browse the repository at this point in the history
The readme has the model and user mdoel names backwards.
I've updated the readme - but probably the actual generators should be
fixed.

Also - I've added proper Rails 3 routing - because the alternative simply
wasn't working with rails 3.
We can probably add some sort of "if RAILS_VERSION == 3" check in here and
use the appropriate one depending on the current rails version in use.
  • Loading branch information
taryneast authored and Jon Gilbraith committed Nov 22, 2010
1 parent 5861c62 commit cbdfd3f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.rdoc
Expand Up @@ -18,7 +18,7 @@ model and the name of the User model.

For all examples in the readme, we will use Message and User.

rails generate simple_private_messages:model Message User
rails generate simple_private_messages:model User Message

Now add the following entry to the model which will have the messages

Expand Down Expand Up @@ -107,7 +107,7 @@ A generator is included to create a basic controller and set of views.

Run the simple_private_messages:scaffold generator with the same options as before:

rails generate simple_private_messages:scaffold Message User
rails generate simple_private_messages:scaffold User Message

The controller will be named with the pluralised version of the model name.

Expand All @@ -131,4 +131,4 @@ Thank you to nerdinand for the Rails 3 upgrade.
=== License

Copyright (c) 2007 Jon Gilbraith released under the MIT license
http://en.wikipedia.org/wiki/MIT_License
http://en.wikipedia.org/wiki/MIT_License
Expand Up @@ -26,9 +26,13 @@ def go
@singular_lower_case_parent = user_model_name.singularize.underscore
@plural_lower_case_parent = user_model_name.pluralize.underscore

route("resources :#{@plural_lower_case_parent} do
resources :#{@plural_lower_case_name}, :collection => { :delete_selected => :post }
end")
route("resources :#{@plural_lower_case_parent} do
resources :#{@plural_lower_case_name} do
collection do
post :delete_selected
end
end
end")

#directory "app/controllers"
template "controller.rb", "app/controllers/#{@plural_lower_case_name}_controller.rb"
Expand Down

0 comments on commit cbdfd3f

Please sign in to comment.