• #2楼 @kgen 网站不错,host在哪里?

  • #5楼 @metal 确实是没有

    bundle exec rake assets:precompile RAILS_ENV= production
    

    的问题

    虽然openshift的提示了

    remote: Precompiling with 'bundle exec rake assets:precompile'
    

    但是似乎它没有正确工作,当我在.openshift/action_hooks/deploy的文件中增加

    bundle exec rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
    

    重新上传,application.css工作正常。

  • #4楼 @metal

    还没有试,刚好有这个想法。

    在本地执行rake assets:precompile又可以正确生成哦,只是上传到openshift的时候没有生成,这是让人困惑的地方。

  • #1楼 @metal 上传到openshift的时候,显示已经执行

    remote: Precompiling with 'bundle exec rake assets:precompile'
    

    而且同目录下的home.scss已经正确生成home.css

  • 不确定是否跟production.rb有关不,这里也贴一下

    cat config/environments/production.rb

    RailsApp::Application.configure do
      # Settings specified here will take precedence over those in config/application.rb
    
      # Code is not reloaded between requests
      config.cache_classes = true
    
      # Full error reports are disabled and caching is turned on
      config.consider_all_requests_local       = false
      config.action_controller.perform_caching = true
    
      # Disable Rails's static asset server (Apache or nginx will already do this)
      config.serve_static_assets = true
    
      # Compress JavaScripts and CSS
      config.assets.compress = true
    
      # Don't fallback to assets pipeline if a precompiled asset is missed
      # config.assets.compile = true
      config.assets.compile = true
    
      # Generate digests for assets URLs
      config.assets.digest = false
    
      # Defaults to nil and saved in location specified by config.assets.prefix
      # config.assets.manifest = YOUR_PATH
    
      # Specifies the header that your server uses for sending files
      # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
      # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
    
      # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
      # config.force_ssl = true
    
      # See everything in the log (default is :info)
      # config.log_level = :debug
    
      # Prepend all log lines with the following tags
      # config.log_tags = [ :subdomain, :uuid ]
    
      # Use a different logger for distributed setups
      # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
    
      # Use a different cache store in production
      # config.cache_store = :mem_cache_store
    
      # Enable serving of images, stylesheets, and JavaScripts from an asset server
      # config.action_controller.asset_host = "http://assets.example.com"
    
      # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
      # config.assets.precompile += %w( search.js )
      # config.assets.precompile += ["*.js", "*.css"]
    
      # Disable delivery errors, bad email addresses will be ignored
      # config.action_mailer.raise_delivery_errors = false
    
      # Enable threaded mode
      # config.threadsafe!
    
      # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
      # the I18n.default_locale when a translation can not be found)
      config.i18n.fallbacks = true
    
      # Send deprecation notices to registered listeners
      config.active_support.deprecation = :notify
    
      # Log the query plan for queries taking more than this (works
      # with SQLite, MySQL, and PostgreSQL)
      # config.active_record.auto_explain_threshold_in_seconds = 0.5
    end
    
  • 招远程办公的不?

  • #19楼 @chenge 同意!

  • #10楼 @neverlandxy_naix 第一次打开页面,得到的object_id是 33495240 第二次刷新页面,得到的object_id是 35038600

    呵呵,有啥优化方法?

    #9楼 @chenge 有没有具体点的?

  • 我使用了helper方法来实现本帖提到的这些需求

    def site_conf(key)
      @conf ||= YAML.load_file("#{Rails.root}/config/site.yml")
      @conf[key]
    end
    

    这样,我在页面HAML模板中就可以这样使用了

    %h1= link_to site_conf('title'), root_url
    

    我的YAML文件site.yml

    title: i'm a ruby bird
    

    现在基本能工作了,单还是有一个问题,就是 每次调用site_conf,是不是就直接返回@conf了? 我知道

    @conf ||= YAML.load_file("#{Rails.root}/config/site.yml")
    

    是有定义就返回@conf,没有就执行后一句

    但是ruby的变量有作用域,第一调用site_conf获得的@conf,再第二次调用是否依然可用??

  • #1楼 @iBachue 好主意

没有介绍