Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
convenient-actionpack
Advanced tools
Under construction... Watch your head.
Making common things easier for ActionController, etc.
In your Rails 3.1+ project, add this to your Gemfile:
gem 'convenient-actionpack', :git => 'git://github.com/garysweaver/convenient-actionpack.git'
Then run:
bundle install
Provides a wrap method to rescue StandardError to return an informative JSON error from JSON services instead of HTML when there is an error:
def create
wrap do
@my_model.save
respond_with @my_model
end
end
If you don't like the standard functionality, you can implement a single error handling method in your ApplicationController to handle errors from all wrapped action methods:
def on_action_error(error)
case params[:format].to_sym
when :json
respond_with({errors: [error.message]}, location: nil, status: :internal_server_error)
else
raise error # should include prior backtrace
end
end
Originally was meant to provide a respond method that would skirt some of the unintuitive behavior of respond_with like #2798, and provide additional functionality, but that is commented for now. Maybe will get to it later. Feel free to fork/submit pull requests.
Copyright (c) 2012 Gary S. Weaver, released under the MIT license.
FAQs
Unknown package
We found that convenient-actionpack 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.