
Security News
rv Is a New Rust-Powered Ruby Version Manager Inspired by Python's uv
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
In most cases you will have the same old code in your controllers, this gem allows some very basic assumptions while giving you the option to override the behavior. This allows your controllers to be limited to just the required code.
Assumptions this code makes:
ArticlesController
will assume Article
model.index
, show
, new
, create
, edit
, update
, destroy
.permitted_attributes
exists for permitted_params
.Here's an example of the bare minimum code required to get started:
ArticlesController < ApplicationController
include ImplicitResource # Opt in to implicit behavior, or include it in ApplicationController.
private
def permitted_params
params.require(:article).permit(:title, :body)
end
end
Add this line to your application's Gemfile:
gem "implicit_resource"
Add this line to your controller
include ImplicitResource
ImplicitResource only targets basic controller functionality. Everything that implicit_resource
does can be overriden in the controller.
You can override the collection
and resource
methods to achieve more flexibility in how things are queried.
ArticlesController < ApplicationController
include ImplicitResource
private
def collection # Collection is a placeholder for any collection of objects to be returned
model_klass.includes(:comments).search(title: params[:title_search_terms])
end
def resource # Resource is a placeholder for any single object to be returned
collection.find_by(token_id: params[:token_id])
end
end
You can override the model_klass
method to allow for controller/model naming mismatch.
ArticlesController < ApplicationController
include ImplicitResource
private
def model_klass
Story
end
end
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that implicit_resource demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.