
Security News
NIST Under Federal Audit for NVD Processing Backlog and Delays
As vulnerability data bottlenecks grow, the federal government is formally investigating NIST’s handling of the National Vulnerability Database.
Allows you to make really simple non-persisted form objects or models.
Only suitable for Rails 4 applications.
You don't need to remember to:
include ActiveModel::Model
model_name
so Rails url generation works for forms.It gives you:
ActiveModel::Model
you can use standard Rails validations on your attributes.Add this line to your application's Gemfile:
gem 'simple_form_object'
And then execute:
$ bundle
Create a form class. I like to put them inside app/forms/
. If you
prefer to create models then that will work too.
class PostForm
include SimpleFormObject
attribute :body, :text
attribute :title, :string
attribute :publish_date, :datetime, default: Time.now
validates_presence_of :body
validates_presence_of :title
end
SimpleFormObject
includes ActiveModel::Model
so you don't need to.
It also intelligently sets the model_name
on the class so that Rails
routing works as expected. As an example:
<%= simple_form_for @post_form do |f| %>
<%= f.input :title # renders a simple string input %>
<%= f.input :body # renders a textarea %>
<%= f.input :publish_date # renders a datetime select html element %>
<% end %>
Will create a HTML form which will POST
to posts_path
.
spec
but better tests wouldn't hurt.git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that simple_form_object 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
As vulnerability data bottlenecks grow, the federal government is formally investigating NIST’s handling of the National Vulnerability Database.
Research
Security News
Socket’s Threat Research Team has uncovered 60 npm packages using post-install scripts to silently exfiltrate hostnames, IP addresses, DNS servers, and user directories to a Discord-controlled endpoint.
Security News
TypeScript Native Previews offers a 10x faster Go-based compiler, now available on npm for public testing with early editor and language support.