Skip to content

Instantly share code, notes, and snippets.

@kainage
Created October 16, 2015 22:15
Show Gist options
  • Save kainage/0fd9dc88c6d1e70eb0f7 to your computer and use it in GitHub Desktop.
Save kainage/0fd9dc88c6d1e70eb0f7 to your computer and use it in GitHub Desktop.
Clattrs & Obthods with Console Support
module MyApp
class Application
console do
Rails::ConsoleMethods.send :include, ConsoleAddons
end
end
end
module ConsoleAddons
def clattrs(model)
puts model.inspect.to_s.split(',').sort
end
def obthods(obj)
methods = obj.methods - Object.methods
if obj.is_a? ActiveRecord::Base
methods -= ActiveRecord::Base.methods
end
pp methods.sort
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment