Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
= DateCheckbox
This is a rails-plugin which can create a checkbox for attributes which are datetime-fields in the database. So, if you want to store the date when a user appected some terms or received some goods, but want to circumvent the need of selecting the proper date and time from 6 dropdowns, you can just use this plugin.
It creates some wrapper-methods on the model for the attributes you specify and provides a form-helper which uses these. The model-methods also work with standard checkbox-tags.
Personally, I do not want to go through the hassle of selecting the proper date and time from 6 dropdowns. I just want to check a checkbox and have my app to the rest. In many cases, this is even required security- or permission-wise.
While this functionality is fairly easy to implement for one datetime-field (like terms_accepted_at), I don't like to repeat this code.
Therefore, I put this rails-plugin together.
A neat side-effect is, that I went and created a form-helper and added some useful model methods along the way.
== Installation
Just add
gem 'date_checkbox'
to your Gemfile. If your not using Bundler and Rails3 by now, we can still be friends, but thats about it.
== Example
class User < ActiveRecord::Base has_date_checkbox :terms_accepted_at end
This adds the following three methods to the user-model:
You can use it the form-helper like this:
<%= form_for @user do |f| %>
<%= f.date_checkbox :terms_accepted_at %>
<% end -%>The date_checkbox appends the date form the database if its selected. If you do not want that, simply use
f.checkbox :terms_accepted
This is what f.date_checkbox uses anyway.
== Notes
Currently, I hook into ActionPack/ActionView directly, which is dirty by saves you from declaring a different FormBuilder for every form. I also refrained from changing the default-form builder for you because I don't want to conflict with other form-extensions you might want to use.
If everything goes south, you can still use the model-methods. This is not (by any means) über-rocket-science. It's just convenient.
Your turn.
== Development
Cpt. Obvious told me the following:
This is open-sourced on github. You can contribute by sending pull-requests or just opening issues.
He is obviously right and you also knew that. Any feedback is appreciated.
Copyright (c) 2011 Matthias Viehweger, released under the MIT license
FAQs
Unknown package
We found that date_checkbox 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.