Skip to content

Instantly share code, notes, and snippets.

@poysama
Last active December 19, 2015 11:29
Show Gist options
  • Save poysama/5947716 to your computer and use it in GitHub Desktop.
Save poysama/5947716 to your computer and use it in GitHub Desktop.
How do you access a class that is inside a module in another module without specifying its scope?
#!/usr/bin/env ruby
module AwesomeProject
module Models
class User
def intialize
end
end
end
end
module AwesomeProject
module Workflow
# I want to access the User class here as User and not Models::User
def self.create_user
Models::User.new
puts "User created!"
end
end
end
AwesomeProject::Workflow.create_user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment