Pundit: The master README doesn't synchronize with the latest gem

Created on 6 Jan 2017  路  9Comments  路  Source: varvet/pundit

In the master branch README, there is a new feature:

authorize returns the object passed to it, so you can chain it like this:
Controller:

def show
  @user = authorize User.find(params[:id])
end
You can easily get a hold of an instance of the policy through the policy method in both the view and controller. This is especially useful for conditionally showing links or buttons in the view:

<% if policy(@post).update? %>
  <%= link_to "Edit post", edit_post_path(@post) %>
<% end %>

But the latest gem(1.1.0) haven't add this feature, maybe the default branch master should synchronize with the latest release gem, we can add the new feature with docs updated in other branch.

Most helpful comment

I second that. Please release a new version of pundit?

All 9 comments

It's important to remember when viewing a README of a repo that the README is _usually_ for the master branch of that repo. If you want docs tied to a specific version of a gem, you should view the generated docs on RubyDoc: http://www.rubydoc.info/gems/pundit

This is not specific to Pundit and is generally true of most gems that host their source on Github.

@damien Thanks.

If a gem didn't provide a yard doc, how can I find the latest gem doc?

@pinewong If you have RDoc or YARD installed on your machine, you can just run such documentation tools against the source code and they'll generate some HTML documentation for you to peruse. The quality of generated docs can vary a lot depending on how well the source code is annotated, but this should work with pretty much any ruby project.

YARD has a pretty good getting started guide here if you'd like to try it yourself: http://www.rubydoc.info/gems/yard/file/README.md

PS: YARD is documented with YARD. Very meta.

@damien Thanks again.

I know RDoc and YARD, but I only want to see the README(quick docs) of latest gem in the beginning, it seems to be troublesome if we generate docs locally.

May be our master README can provide a doc link of latest gem like some projects do:

WARNNING:
This is a readme of the current master. If you are using the released gem, please take a look at gem readme(v1.1.0)

That change is also too old (9 months ago)!: https://github.com/elabs/pundit/pull/385#issuecomment-230114713
For YARD I use "Dash" doc viewer https://kapeli.com/dash

I agree with @pinewong. I lost almost an hour just to figure out that the lastest gem version was different from master branch, what I'm not used to it.

I know the code is in front of me, but is there any problem in generating a new gem version for the master branch? I'm here to help. And thanks for this awesome project!

I second that. Please release a new version of pundit?

would very much like the current master build too. Checked the commit since latest release and i can realy use some of the new features.

Closing in favor of #467

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ucarion picture ucarion  路  4Comments

jkepps picture jkepps  路  4Comments

lnikkila picture lnikkila  路  5Comments

ghost picture ghost  路  5Comments

epinault picture epinault  路  6Comments