Skip to content

Commit

Permalink
LOL-copy-and-paste
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Aug 23, 2011
1 parent 07bcdbf commit 23ad335
Showing 1 changed file with 0 additions and 47 deletions.
47 changes: 0 additions & 47 deletions lib/inherited_resources/shallow_helpers.rb
Original file line number Diff line number Diff line change
@@ -1,51 +1,4 @@
module InheritedResources
# = belongs_to
#
# Let's suppose that we have some tasks that belongs to projects. To specify
# this assoication in your controllers, just do:
#
# class TasksController < InheritedResources::Base
# belongs_to :project
# end
#
# belongs_to accepts several options to be able to configure the association.
# For example, if you want urls like /projects/:project_title/tasks, you
# can customize how InheritedResources find your projects:
#
# class TasksController < InheritedResources::Base
# belongs_to :project, :finder => :find_by_title!, :param => :project_title
# end
#
# It also accepts :route_name, :parent_class and :instance_name as options.
# Check the lib/inherited_resources/class_methods.rb for more.
#
# = nested_belongs_to
#
# Now, our Tasks get some Comments and you need to nest even deeper. Good
# practices says that you should never nest more than two resources, but sometimes
# you have to for security reasons. So this is an example of how you can do it:
#
# class CommentsController < InheritedResources::Base
# nested_belongs_to :project, :task
# end
#
# If you need to configure any of these belongs to, you can nested them using blocks:
#
# class CommentsController < InheritedResources::Base
# belongs_to :project, :finder => :find_by_title!, :param => :project_title do
# belongs_to :task
# end
# end
#
# Warning: calling several belongs_to is the same as nesting them:
#
# class CommentsController < InheritedResources::Base
# belongs_to :project
# belongs_to :task
# end
#
# In other words, the code above is the same as calling nested_belongs_to.
#
module ShallowHelpers
include BelongsToHelpers

Expand Down

0 comments on commit 23ad335

Please sign in to comment.