# Trouble with Rails and Lib-Based modules

**URL:** <https://www.ruby-forum.com/t/trouble-with-rails-and-lib-based-modules/90480>\
**Category:** Rails\
**Created:** [March 29, 2007, 3:58am UTC](https://www.ruby-forum.com/t/trouble-with-rails-and-lib-based-modules/90480 "2007-03-29T03:58:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ben-v](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/ecb155/32.png) [@ben-v](https://www.ruby-forum.com/u/ben-v)\
**Post date:** [March 29, 2007, 3:58am UTC](https://www.ruby-forum.com/t/trouble-with-rails-and-lib-based-modules/90480/1 "2007-03-29T03:58:34Z")

</div>

I am trying to create modules and classes based in the Rails lib  
directory for my application to call. However, when ever I try and  
output the result of a method in the class, all that is returned is a  
pound sign. Does anyone have any idea why it is outputting this? I used  
the module examples from the Programming Ruby book’s site , and this  
code:  
class TestModelController \< ApplicationController  
def index  
require ‘ScaleDemo’  
validate = ScaleDemo.new  
render :text =\> validate.to\_s

# Always returns “#”

```
    end

```

end

lib/ScaleDemo.rb

module MajorScales  
def majorNum  
@numNotes = 7 if @numNotes.nil?  
@numNotes # Return 7  
end  
end

module PentatonicScales  
def pentaNum  
@numNotes = 5 if @numNotes.nil?  
@numNotes # Return 5?  
end  
end

class ScaleDemo  
include MajorScales  
include PentatonicScales  
def initialize  
puts majorNum # Should be 7  
puts pentaNum # Should be 5  
end  
end

ScaleDemo.new

Thanks for your help and time.
