• 在lib下编写的自己的类需要用到model内相关方法


    我们在lib下编写的自己的类需要用到model内相关方法时,需要如下设置:

    require_relative 'boot'
    
    require 'rails/all'
    
    # Require the gems listed in Gemfile, including any gems
    # you've limited to :test, :development, or :production.
    Bundler.require(*Rails.groups)
    
    module DomesticTrade
      class Application < Rails::Application
        # Settings in config/environments/* take precedence over those specified here.
        # Application configuration should go into files in config/initializers
        # -- all .rb files in that directory are automatically loaded.
        config.autoload_paths += [
          Rails.root.join('lib')
        ]
        config.eager_load_paths += [
          Rails.root.join('lib/coin_deal_api')
        ]
      end
    end
    
    
  • 相关阅读:
    HttpClient
    Android子线程访问网络
    PhoneURLConnectGEt
    PhoneHttpGet
    PhoneNote
    SQLite
    书单
    通过Web预测网页出版日期的学习
    LeetCode-Maximum Subarray[dp]
    LeetCode-Triangle[dp]
  • 原文地址:https://www.cnblogs.com/dccmmtop/p/7514183.html
Copyright © 2020-2023  润新知