0
While calling method inside button block in SHoes4 it throws error  undefined local variable or method `get_notes' . But when i call inside action it works fine,

Code:

class ShoesApp
 include Shoes
    url '/', :index

    def index
      para 'Say something...'
      flow do
        @note = edit_line
        button 'OK' do
          Note.new(:message => @note.text).save
          @note.text = ''   
          @@result.replace get_notes    # error      
        end         
      end
      @@result = para get_notes # Works fine
    end

    def get_notes
      Note.all.map(&:message).join("\n")
    end
end

Shoes.app :title => 'Notes', :width => 260, :height => 350 
4

1 回答 1

1

感谢您报告此问题。

在将您的脚本调整为当前的 shoes4 主控(例如< Shoes,而不是include Shoes为了向后兼容)之后,堆栈级别太深的脚本错误,这与 URL 系统目前的工作方式(转发消息)有关。URL 系统也是重构的首选,这有望在接下来的 7 天内实现。

请记住,shoes4 仍处于开发阶段,处于 pre-alpha 阶段。所以它还没有真正准备好进行生产使用。

将来,由于更好的可见性,您可能还会在shoes4 问题跟踪器上获得更多运气报告问题。我只是偶然听到。我继续并在那里创建了一个问题

干杯,希望你到目前为止喜欢鞋子,

托比

编辑:哦,是的,顺便说一句,一般来说你真的应该避免使用类变量(@@)它们经常表现得很奇怪并且通常不被认为是好的做法,但这与问题并没有真正的联系

编辑 2:另一件事是 Note 类似乎丢失了,尽管它似乎是内置于 Shoes3 中的。不确定我们是否会保持兼容性。

于 2013-07-05T12:50:45.033 回答