rubysherpas / r4ia

A place to file issues for Rails 4 in Action
2 stars 0 forks source link

MEAP v17. Chapter 8, Listing 8.15 Assigning permission #6

Open mikezx6r opened 9 years ago

mikezx6r commented 9 years ago

I'm having a problem following examples and understanding how it works.

The permissions in the book seem to verify as to whether they have an underscore in them or not.

Verifying permissions, the code has 'create tickets', and yet the checkboxes on the screen appear to be using 'create_tickets'. I don't see anywhere where one gets converted to the other.

If I write my app as per the book, the permissions don't work correctly. As soon as I modify the can? and cannot? entries to include the underscore, everything works correctly.

I was asked to link to a Github repo, but I prefer Bitbucket.

https://bitbucket.org/mikezx6r/ticketee

Commits d1fded8 and f96f93d demonstrate the issue

I've also found the assigning_permissions_spec, 'Creating tickets for a project' doesn't appear to be testing the code. I can comment out the 'check_permission' for create_tickets and the test still passes.

radar commented 9 years ago

Thanks for letting us know about this one @mikezx6r. I think you're right about the checkboxes having the wrong label.

We'll investigate this issue as well as the assigning_permissions_spec problem when we're reviewing Chapter 8, which is a chapter and a half from where we are at now.

mikezx6r commented 9 years ago

No worries. Although it was initially frustrating, it did force me to slow down and REALLY try to understand what I was writing, and how the code was interacting.

Debugging can be a great educator.