Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
= Is Positionable
== What is "Is Positionable"?
Is Positionable handles the positioning (ordering) your ActiveRecord Objects. It makes use of the "Acts As List" gem to do it the most efficient way. Is Positionable basically creates a front-end (dynamically generates buttons and actions) for moving ActiveRecord Objects "up", "down", to the "top" and to the "bottom". Doing the simplest set up takes just 1 word: "is_positionable".
=== Quick and Simple Example
==== config/environment.rb
config.gem "is_positionable", :source => "http://gemcutter.org/"
==== app/controllers/posts_controller.rb
PostsController < ApplicationController is_positionable
def index
@posts = Post.all
end
...
end
==== app/models/post.rb
class Post < ActiveRecord::Base default_scope :order => :position end
==== app/views/posts/index.html.erb
for post in @posts <%= up_button_for_posts(@posts, post) %> <%= down_button_for_posts(@posts, post) %> <%= top_button_for_posts(@posts, post) %> <%= bottom_button_for_posts(@posts, post) %> ... # Other Stuff like post.name post.user.name etc. end
With just this bit of code, you now enabled positioning with "posts". This might already be obvious, but the following 4 buttons are generated per post:
Now, this is the most basic setup. You might have "users" manage posts. So that'd mean "User has_many :posts". In this case you can add a "scope" and "scope_object" so that one user cannot conflict with another user's post positions.
This would look something like this
is_listable :scope => :user_id, :scope_object => current_user
The above will ensure that, not only will one users' post NOT conflict with another users' post, but if one user tries to be hack-ish and try to attempt to change post position of a different user through cURL or the AddressBar it will be out of scope cause of the :scope_object attribute, restricting access to any other user, but the owner of the post.
==== Of course, these are not the only options you can set, for more information, see the Wiki pages!
==== Setting all this up takes me about 1-2 minutes
== Interested in trying out "Is Positionable"?
=== Check out the following Wiki pages:
=== Installation
http://wiki.github.com/meskyanichi/is_positionable/installation
=== Getting Started
http://wiki.github.com/meskyanichi/is_positionable/getting-started
=== Options
http://wiki.github.com/meskyanichi/is_positionable/options
== Copyright
Copyright (c) 2009 meskyanichi. See LICENSE for details.
FAQs
Unknown package
We found that is_positionable 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
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.