Wednesday 15 April 2015

ruby - NoMethodError Sinatra Modular app -


Maybe something is quite basic but I want to be able to use some custom support methods in a modular Sinatra app. I have the following. /helpers/aws_helper.rb

  Supporters can file FASAS_set (path). Settings settings.asset_host, Path End End   

And then in my opinion I want to be able to use this method

  & lt; % = Image_tag (aws_asset ('/ assets / images / wd.png'))%>   

But I get the above area, so my app In the RB file I need

 . / Helpers / aws_helper 'class profiles & lt; Sinatra :: Base Mill / ARB: Index and End   

It is my problem that I need this out of my profile class that I do not understand because I have an ENV variable My config files need the same way and they are reading, but then they are not in the way, so I think that means it.

I believe

error message

  

> method for noMethodError / undefined Method `aws_asset ': Profile: 0x007f1e6c4905c0 & gt; File: index.erb Location: SingletonClass Block in Line: 8

> Helpers do ... in the top level like this you add methods such as Sinatra :: Application and not your profile as an assistant Class If you are using Sinatra modular style, make sure that you only need , 'sinatra / base' is required, and S Inatra is not required , it will prevent you from mixing two styles like this

In this case, instead of using assistants ... , you should make a module for your assistants, and then use that module in your profile class

Join settings.asset_host, path end end

in app.rb :

  class profile & lt; Include your helpers in Sinatra :: Base Helpers MyHelpers # / 'ARB: Index & End    

No comments:

Post a Comment