D T
D T

Reputation: 3746

Why does adding my gem to a website not work?

I created a gem Helloword with the command:

bundle gem helloword

enter image description here

I built the gem with the command:

gem build helloword.gemspec

I edited the Gemfile of my Rails app:

gem 'helloword', '0.1.0', path: '/Users/iloveyou/helloword'

and I installed the gem:

bundle install

I am using the gem in my page like:

<h1><%= hello_word_tag %></h1>

I get the result:

enter image description here

Why did adding my gem to the website not work?

Upvotes: 0

Views: 28

Answers (2)

D T
D T

Reputation: 3746

i Fixed: Change:

 def hello_word_tag
    "Hello Word!!!"
  end

to:

 def self.hello_word_tag
    "Hello Word!!!"
  end

and call:

<h1><%= Helloword.hello_word_tag %></h1>

Upvotes: 0

sawa
sawa

Reputation: 168199

Because you haven't called the module Helloword.

Upvotes: 1

Related Questions