Skip to content

Instantly share code, notes, and snippets.

@rahuldstiwari
Created April 5, 2016 06:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rahuldstiwari/b01c229165d50335bba3ea8adc384c8f to your computer and use it in GitHub Desktop.
Save rahuldstiwari/b01c229165d50335bba3ea8adc384c8f to your computer and use it in GitHub Desktop.
rails create module
create a file in lib/foo.rb and put
module Foo
def self.hello
puts "ohohohohhhohohohoh"
end
end
-----include in controller-----
include Foo
------call module function in controller's action-----
Foo::hello
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment