oggy / looksee

Supercharged method introspection in IRB
MIT License
364 stars 14 forks source link

Compatibility problem with ActiveAdmin gem #18

Closed maziz closed 10 years ago

maziz commented 12 years ago

When used alongwith ActiveAdmin gem, the Edit views (of entities registered in admin) always raise this error:


Unknown action

AbstractController::ActionNotFound


( My setup : Rails 3.1.3 , Ruby 1.9.3 , rbEnv )

ivanoats commented 12 years ago

this is happening to me too

skyjumper commented 12 years ago

I also reported this as an issue to active_admin.

Here's a workaround:

Looksee.rename(:edit => 'looksee_edit')
mogox commented 11 years ago

This is also an issue if you have modules with the action edit and include them in a controller.

Let's say you have:

#Accounts edit
module AccountsEditor
  def edit
     @account = Account.new
     render partial: 'edit'
  end

And then:

class UserAccountController < ApplicationController
  include AccountsEditor

  def index
     @users = Users.all
  end
end

Before require 'looksee':

  UserAccountController.action_methods
  #<Set: {"index", "edit"}>

After:

  UserAccountController.action_methods
  #<Set: {"index"}>

Although @skyjumper suggested a great workaround I don't think this small issue should prevent us from using this awesome gem.

What do you think @oggy?

oggy commented 11 years ago

Sorry for the long delay.

I hear you guys - method collisions are never fun. Looksee.rename was intended for exactly these sorts of use cases, but I get that edit was a particularly bad choice due to Rails controller conventions.

I'll get on this. My latest thought is to do object.ls.edit rather than object.edit. The idea being that everything Looksee does should be "namespaced" under ls (which can still be rename-d). Let me know if any thoughts.

mogox commented 11 years ago

:+1: on the namespaced edit under ls

oggy commented 10 years ago

Pushed this in v2.0.0.