
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
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
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.