0.0
No release in over 3 years
Low commit activity in last 3 years
auto set parent_resources in controller.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

> 3.2.0
 Project Readme

Build Status Dependency Status Scrutinizer Code Quality Coverage Status

parent_resource

in the controller of recursive resource, auto load parent resource

Installation

Add this line to your application's Gemfile:

gem 'parent_resource'

Usage

config/routes.rb

 resources :members
 resources :projects do
   resources :members
 end

app/controller/members_controller.rb

 # auto load @project when like /projects/1/members
 # not load when /members
 class MembersController < ActionController::Base
   parent_resource :project
 end

app/view/members/new.html.erb

 # you can support both /projects/1/members/new and /members/new with single file
 <% form_for([@project, @member]) do |f| %>
    ...
 <% end %>

Contributing

  1. Fork it ( https://github.com/masarakki/parent_resource/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request