Updates from July, 2015 Toggle Comment Threads | Keyboard Shortcuts

  • ThomasPowell 12:30 pm on July 31, 2015 Permalink
    Tags: pundit,   

    Pundit: NoMethodError (undefined method `verify_authorized’ for [WhateversController]) 

    Sometimes, having done things several times before can make you miss the OBVIOUS.

    After adding

      after_action :verify_authorized

    to my ApplicationController to verify that Pundit was being used for authorization, I got the following error in rspec:

      2) Jobs GET /jobs works! (now write some real specs)
         Failure/Error: get jobs_path
           undefined method `verify_authorized' for #
         # ./spec/requests/jobs_spec.rb:6:in `block (3 levels) in '

    Maybe there’s a problem with my RSpec? Nope:

    Started GET "/" for at 2015-07-31 07:13:17 -0500
    Processing by JobsController#index as HTML
      Job Load (0.1ms)  SELECT "jobs".* FROM "jobs"
      Rendered jobs/index.html.slim within layouts/application (0.5ms)
    Completed 500 Internal Server Error in 8ms
    NoMethodError (undefined method `verify_authorized' for #):

    Okay, does ApplicationController have the method?!

    irb(main):008:0> ApplicationController.new.methods.include? :verify_authorized
    => false

    Ok, am I doing that wrong?

    irb(main):010:0> ApplicationController.new.methods.include? :authenticate_user!
    => true

    Sigh. *Rereads documentation.*

    Screenshot 2015-07-31 07.25.24

    What’s missing? Oh yeah, a simple `include Pundit’ in the ApplicationController

  • ThomasPowell 11:22 pm on July 27, 2015 Permalink
    Tags: ,   

    Bootstrap 3 radio-inline and checkbox-inline elements running together. 

    I was having issues with Bootstrap 3 radio buttons running together even though the labels had a “radio-inline” attribute.

    After examining the layout of the html being generated, I realized that each individual label and radio button was being wrapped in its own containing element (in this case, a “td” element.)

    The reason for this is the following CSS:

    .radio-inline + .radio-inline, .checkbox-inline + .checkbox-inline {
      margin-top: 0;
      margin-left: 10px;

    If the .radio-inline elements aren’t adjacent to each other, the ‘margin-left’ value will not trigger.

    Unfortunately, it took a little too long to track down the source of the issue, but now I know.

Compose new post
Next post/Next comment
Previous post/Previous comment
Show/Hide comments
Go to top
Go to login
Show/Hide help
shift + esc
%d bloggers like this: