
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.
sentient_model is simple piece of code trying to solve a common problem.
Imagine you are writing an authentication system for Ruby on Rails. Usually you would define a method called current_user
in your ApplicationController
and expose it to your views and so on (which is fine in most cases).
However, if you need current_user
in locations where you can't easily expose the method, sentient_model is the perfect solution. Instead of manually exposing current_user
, you would just rely on User.current
. sentient_model's methods are globally accessible - therefore you don't have to worry about anything - it just works.
This Gem has been inspired by David Bock's sentient_user.
Define your models as usual and include the module SentientModel
:
class YourModel
include SentientModel
# more code such as validations or associations
end
By including SentientModel
, the following methods are added to your model:
YourModel#make_current # instance method - makes the callee object the sentient object
YourModel#current? # instance method - true if the callee is the current sentient object or false otherwise
YourModel.current # class method - returns the sentient object or nil
YourModel.current=(m) # class method - sets the sentient object to the supplied argument (must be an instance of YourModel)
YourModel.has_current? # class method - true if a sentient object defined or false otherwise
rake spec
).Copyright ©2011 Christoph Schiessl. See LICENSE for details.
FAQs
Unknown package
We found that sentient_model 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.