Adds a resource_class
method to Rails Controllers.
class VehiclesController < ApplicationController
# resource_class automatically set to Vehicle
def new
@vehicle = resource_class.new
end
end
You can also specify the resource_class
to be used.
class HyperloopController < ApplicationController
set_resource_class Vehicle
end
Don't want a resource_class
for a controller?
class JetpackController < ApplicationController
set_resource_class false
end
##Installation
gem "controller_resource_class"
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request