• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

activeadmin / activeadmin / 4996
79%

Build:
DEFAULT BRANCH: master
Ran 20 Aug 2016 01:59AM UTC
Jobs 3
Files 137
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
4996

Pull #4590

travis-ci

web-flow
Not override but add behaviour to existing member or collection action if the same name specified

If somebody wants to create an action, that handles multiple HTTP verbs, they might write code like this:

          ActiveAdmin.register Post do
            member_action :action_name, method: :get do
              # do something on GET request
            end

            member_action :action_name, method: :post do
              # do something on POST request
            end
          end

But this will not work as expected. There is no magic  )
The second declaration will override the first one.

Furthermore, there will be 2 routes generated (GET, POST), that is strange.

If there are two routes, why one behaviour?

At least, If action is overrided then previous route should be removed.

This commit adds a lot of magic and automatically turns the above code into something like this:

          ActiveAdmin.register Post do
            member_action :action_name, method: [:get, :post] do
              if request.post?
                # do something on POST request
              else
                # do something on GET request
              end
            end
          end

In case when action name and http verb both the same as previous declared,  the latest declaration overrides the privious ones.

This works for both member and collection actions and with any combination of actions and http verbs.
Pull Request #4590: Custom Controller Actions: Allow create an action with the same name, that handles multiple HTTP verbs a more natural way

62 of 62 new or added lines in 5 files covered. (100.0%)

3098 of 3827 relevant lines covered (80.95%)

29.81 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
2
100.0
lib/active_admin/resource.rb
7
100.0
lib/active_admin/resource/controller_actions.rb
7
100.0
lib/active_admin/resource_dsl.rb
18
100.0
lib/active_admin/resource_controller/action_verb_combiner.rb

Uncovered Existing Lines

Lines Coverage ∆ File
1
100.0
lib/active_admin/resource_dsl.rb
Jobs
ID Job ID Ran Files Coverage
3 4996.3 (2.3.0, RAILS=3.2.22) 20 Aug 2016 02:00AM UTC 0
80.66
Travis Job 4996.3
4 4996.4 (2.3.0, RAILS=4.2.5) 20 Aug 2016 01:59AM UTC 0
80.77
Travis Job 4996.4
5 4996.5 (2.3.0, RAILS=5.0.0) 20 Aug 2016 02:00AM UTC 0
80.77
Travis Job 4996.5
Source Files on build 4996
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #4996
  • Pull Request #4590
  • PR Base - master (#4987)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc