Ruby on Rails folder structure with helpers
<p>I have to make a rails API only i.e. input is POST request and output will be an JSON response. I have to interact with mysql database with my own table names i.e. mysql tables are already created. 
Below is the folder structure with "helpers" even though we are not using any "views". We are accessing the helper methods from our controllers. Please confirm if I am correct or not. Thanks in advance.</p>

<p>1) app/controllers/application_controller.rb</p>

<pre><code> class ApplicationController &lt; ActionController::API
      # Prevent CSRF attacks by raising an exception.
      # For APIs, you may want to use :null_session instead.
      protect_from_forgery with: :exception
    end
</code></pre>

<p>2) app/controllers/feature_management_controller.rb</p>

<pre><code>class FeatureManagementController &lt; ApplicationController

  def populate_bean


    @json = OrionCountryList.new.sample_function
  end

  def send_response(bean)
    helper = FeatureManagementHelper.new
    if (bean.method.eql?"get_feature_list") &amp;&amp; (!bean.app_key.blank?) &amp;&amp; (bean.app_key!=nil) &amp;&amp; (bean.app_key.casecmp("NULL")!=0)
      logger.info bean.print_bean "Request for fetching featureList by app_key : " + bean.app_key.to_s + " And userID: " + bean.user_id.to_s
    @@json_response = helper.get_feature_list bean

    else
      logger.error "METHOD NOT FOUND. method during feature management :"+bean.method+" app_key :"+bean.app_key
      @@json_response = {:message =&gt; "API not avaliable"}
    end
    logger.info("Final json_response sent to app : "+@@json_response.to_json)
    render :json =&gt; @@json_response
  end
end
</code></pre>

<p>3) app/helpers/application_helper.rb</p>

<pre><code>class ApplicationHelper 
    APP_CONFIG = YAML.load(File.read(File.expand_path('../../../config/app_config.yml', __FILE__)))
end
</code></pre>

<p>4) app/helpers/feature/feature_management_helper.rb</p>

<pre><code>class FeatureManagementHelper 

  def get_feature_list(bean)
    response = Hash.new
    response = {:success_code =&gt; "1"}
    return response
  end

end
</code></pre>

<p>Here we are using "class" key word inside the helpers. But on searching, it seems "module" key word is needed. But we couldn't find the way to access module methods of helpers inside controllers.</p>

<p>Any help is appreciated.Thanks!!! </p>

<h2>UPDATE</h2>

<p>@Ekkerhard, Thanks for the suggestion,
I have refrained from using helpers in the above way mentioned and instead used PORO for implementing my business logic as suggested by @spikermann using 
<a href="http://vrybas.github.io/blog/2014/08/15/a-way-to-organize-poros-in-rails/" rel="nofollow">this_link</a></p>

<p>Upon implementing the changes, my code structure looks something like this:</p>

<p>1) app/controllers/feature_management_controller/feature_management.rb</p>

<pre><code>class FeatureManagementController
  class FeatureManagement
    def get_feature_list(bean)
      response = Hash.new
      response = {:success_code =&gt; "1"}
      return response
    end
  end
end
</code></pre>

<p>Similarly for any controller "test_controller" I have a folder named "test_controller" at the location /app/controllers/
and I am keeping the business logic inside a test.rb file inside this "test_controller" folder.</p>

<p>2) We have all the controllers inside the /app/controllers</p>

<p>3) We have all the models inside the /app/models </p>

<p>4) We are reading the configuration file inside /config/application.rb</p>

<pre><code> class Application &lt; Rails::Application
    config.autoload_paths += Dir["#{config.root}/lib/**/"]
    APP_CONFIG = YAML.load(File.read(File.expand_path('app_config.yml', __FILE__)))
    config.time_zone = "New Delhi"
    config.active_record.default_timezone = :local
    config.autoload_paths += Dir["#{config.root}/app/**/"]
 end
</code></pre>

<p>Though if I read the config file from the feature_management.rb file things are working just fine i.e. adding this line to the feature_management.rb file : </p>

<p>/app/controllers/feature_management_controller/feature_management.rb</p>

<pre><code>APP_CONFIG = YAML.load(File.read(File.expand_path('../../../../config/app_config.yml',
__FILE__)))
</code></pre>

<p>but upon trying to read the configuration from the application.rb file I am getting an error : </p>

<pre><code>NameError (uninitialized constant FeatureManagementController::FeatureManagement::APP_CONFIG):
</code></pre>

<p>I was wondering whether this is the correct way to proceed and is there a better way to do it.</p>

<p>Appreciate your inputs..!!!</p>