Skip to content

Pundit Integration #2399

Merged
mshibuya merged 5 commits into
railsadminteam:masterfrom
jayasi:integration_pundit
Sep 19, 2015
Merged

Pundit Integration #2399
mshibuya merged 5 commits into
railsadminteam:masterfrom
jayasi:integration_pundit

Conversation

@jayasi

@jayasi jayasi commented Sep 10, 2015

Copy link
Copy Markdown
Contributor

Integration of the Pundit gem. #2120

  • (Team CodeBenders, RGSoC'15)

@sferik

sferik commented Sep 11, 2015

Copy link
Copy Markdown
Collaborator

@jayasi The tests are failing on Travis CI? The problem appears to be:

/home/travis/build/sferik/rails_admin/spec/spec_helper.rb:9:in `require': cannot load such file -- pundit/rspec (LoadError)

Can you please look into fixing that?

@mshibuya

Copy link
Copy Markdown
Member

Version-specific Gemfiles under gemfiles/* also need to be updated, running

$ appraisal install

will do the job.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes Pundit required dependency, we should make it optional choice.

@jayasi

jayasi commented Sep 15, 2015

Copy link
Copy Markdown
Contributor Author

@sferik, @mshibuya Thank you for your feedback. Have made changes accordingly.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about this issue?
We really need to get rid of this ugly case-when chain.

@jayasi

jayasi commented Sep 16, 2015

Copy link
Copy Markdown
Contributor Author

@sferik, @mshibuya, I've removed the need for the case-when chain by modifying the authorization adapter.

The CI test that is failing is for Ruby 2.2, but I am unable to reproduce it locally. I tried
BUNDLE_GEMFILE=/Users/jayasimehar/Desktop/rails_admin/gemfiles/rails_4.2.gemfile

CI_ORM=mongoid

bundle exec rspec ./spec/integration/config/edit/rails_admin_config_edit_spec.rb

And all tests are passing.

mshibuya added a commit that referenced this pull request Sep 19, 2015
@mshibuya mshibuya merged commit 4eecd02 into railsadminteam:master Sep 19, 2015
@mshibuya

Copy link
Copy Markdown
Member

LGTM

Merged in 🔨
Thanks so much, @Team-CodeBenders ❤️

@mshibuya

Copy link
Copy Markdown
Member

@jayasi @meghaarora42 Additionally, you may be interested in creating Wiki entry, which will promote use of this change.

@jayasi

jayasi commented Sep 19, 2015

Copy link
Copy Markdown
Contributor Author

@mshibuya Thank you 😄

We will create the wiki entry.

@meghaarora42

Copy link
Copy Markdown
Contributor

@mshibuya Thank you for all the help! :D

@dalpo

dalpo commented Sep 19, 2015

Copy link
Copy Markdown
Contributor

Thank you Rails Girls!!! 👏 👏 👏

687474703a2f2f7777772e7265616374696f6e676966732e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031332f31302f62696c6c2e676966

@kgrz

kgrz commented Sep 19, 2015

Copy link
Copy Markdown

👏🏼

@ronen

ronen commented Oct 15, 2015

Copy link
Copy Markdown
Contributor

Do you have a timeline for a (minor) release that includes this? I've already started using rails_admin with pundit (:clap: :clap: :clap:), but I'd rather not install from master branch. Thanks!

@md5

md5 commented Dec 12, 2015

Copy link
Copy Markdown

@jayasi Did you ever create a wiki entry for this? I'm not seeing one.

I'm wondering how access to the RailsAdmin dashboard is supposed to be authorized. I'm seeing RailsAdmin trying to call dashboard? on an ApplicationPolicy instance with policy.record = nil. It seems like it should be getting a RailsAdminPolicy with Pundit.policy(current_user, :rails_admin) and calling dashboard? on that.

Some guidance on how to use the :pundit authorization method would be appreciated.

@md5

md5 commented Dec 12, 2015

Copy link
Copy Markdown

I also see it trying to call history? on my model's policies when paper_trail integration is enabled.

@mxmzb

mxmzb commented Apr 2, 2016

Copy link
Copy Markdown

+1 would appreciate a wiki on this.

PS.: I liked the nested approach more, it gave you more power: bf63d68

@aeons

aeons commented May 15, 2016

Copy link
Copy Markdown

Anyone figured out how to use this?

@tquill

tquill commented Jun 20, 2016

Copy link
Copy Markdown

Any time frame for updating the documentation on this?

@masciugo

masciugo commented Oct 5, 2016

Copy link
Copy Markdown

@mxmzb

mxmzb commented Oct 7, 2016

Copy link
Copy Markdown

Since rails_admin 1.0 stable (worked in rc1) I am getting an undefined method 'policy' for #<RailsAdmin::MainController:0x007fcffdaf1c28> with Pundit integration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.