0
未定義的方法'你好」爲Karlsgem :: KarlsGeming:類回報率 - 未定義的方法'你好「爲Karlsgem :: KarlsGeming:類
請大家幫忙,我只是希望它在視圖中顯示的字符串的不能似乎包裹我的頭圍繞?我在錯誤的文件中?
karlsgem.rb
require "karlsgem/version"
module Karlsgem
class KarlsGeming
def hello
puts "Hello World"
end
end
end
index.html.erb
<% if notice %>
<p id="notice" ><%= notice %></p>
<% end %>
<%= @kgem %>
<h1>Your Drinks Catalog</h1>
<% @products.each do |product| %>
<div class="entry" >
<%= image_tag(product.image_url) %>
<h3><%= product.title %></h3>
<%=sanitize product.description %>
<div class="price_line" >
<span class="price" >€<%= product.price %></span>
<%= button_to 'Add to Cart' , line_items_path(:product_id => product) %>
</div>
</div>
<% end %>
store_controller.rb
require 'karlsgem'
class StoreController < ApplicationController
def index
@products = Product.all
@cart = current_cart
@kgem = Karlsgem::KarlsGeming.hello
end
end
它只是調用從寶石的方法,不知道爲什麼即時得到錯誤 – megatron2000 2013-04-05 17:11:25