Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Rails plugin for adding JQuery DataTables to your application.
DataTables: http://datatables.net/index
Requirements:
JQuery, JQuery UI, and the DataTables JQuery plugin
For Ohm Support: redis, Ohm, Lunar
Features:
Easy definition of a table for an ActiveRecord and Ohm model. Supports pagination.
Add tests. Add sorting.
In your controller, set up a datatables source. This is how the data is pulled from the server and returned with AJAX.
ActionView::Base.send :include, DataTablesHelper ActionController::Base.send :include, DataTablesController
datatables_source :users_source, :user, :columns => [ :username, :fullname, {:name => "updated_at", :eval => 'obj.updated_at.getlocal.rfc2822'}, {:name => "Options", :method => :user_options_column}], :numResults => 10
This defines a table, named users_source, for the User model.
The columns are (in order):
username, fullname, updated_at, and options
There are two special ways to display the data for a column/row.
eval:
Evaluates a string, "obj" is an instance of your model in the table (in this case, a User object).
method:
Calls a method in your controller with the instance of your model as the parameter.
When defining a method for a column, an example method in your controller would be:
def user_options_column(user) "<a href="#{url_for :action => 'view', :id => user.id}">View User" end
Because DataTables uses AJAX to load the data in the table, you must define a route to it. The first parameter of datatables_source is a named route. The rails plugin uses this to link the HTML for your DataTable.
map.users_source '/datatables/user', :controller => :user, :action => :users_source
Displaying a table is probably the easiest part. In a view for your controller, you just do the following:
<%= datatables :users_source %>
Copyright (c) 2010 Chris Moos, released under the MIT license Copyright (c) 2012 Duane Compton, released under the MIT license
FAQs
Unknown package
We found that data_tables demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers 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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.