• 部署到生产模式的问题 at 2012年03月01日

    @Rei 说简单点,我 rails new aa 一个新项目,仅仅放一个 1.jpg 到 app/assets,然后在HomeController#index对应的index.html.erb中引用 <%=image_tag 1.jpg%> 在开发模式中正确,能显示,然后执行 rake assets:recompile 无错误,查看 public/assets 已经有了 1.jpg 及 1-sdfsafsdafsda.jpg 并且 public/assets/mainifest.yml中也有相关内容。然后 rails s -e production 启动 访问该页面,图片直接出布来,这是最简单的例子。

    上个回复贴的内容,是我在项目中的情况,目前是 ingo.js 没有,有时候显示 application.js 这些斗报 isn't recompile 郁闷啊。

    我 rails 版本是 3.2.1,rake 过后必定重启。哪位大神帮忙看看,郁闷啊,要不然生产上只有部署 develope 了。。

  • 部署到生产模式的问题 at 2012年02月29日

    @Rei 帮忙看看,谢谢

  • 部署到生产模式的问题 at 2012年02月29日

    production.rb:

    Ml7Tch::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 = false
    
      # Compress JavaScripts and CSS
      config.assets.compress = true
    
      # Don't fallback to assets pipeline if a precompiled asset is missed
      config.assets.compile = false
    
      # Generate digests for assets URLs
      config.assets.digest = true
    
      # Defaults to Rails.root.join("public/assets")
      # 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( style.css ingo.css ingo.js )
    
      # 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
    

    rake assets:precompile 没有报错

    ls public/assets:
    
    application-376598dc6b01c22c358813b48e8ffeaf.js
    application-376598dc6b01c22c358813b48e8ffeaf.js.gz
    application-380a64fb011e4afb121d4fc16c958c38.css
    application-380a64fb011e4afb121d4fc16c958c38.css.gz
    application.css
    application.css.gz
    application.js
    application.js.gz
    ingo-77eddf4f547c4b1e9db84bfbef2cc14a.js
    ingo-77eddf4f547c4b1e9db84bfbef2cc14a.js.gz
    ingo-c2060dfa713e84f751926a58bb416cae.css
    ingo-c2060dfa713e84f751926a58bb416cae.css.gz
    ingo.css
    ingo.css.gz
    ingo.js
    ingo.js.gz
    jstest-aa3ac1b728fbaa633fdfd9243a1c1bc8.html
    jstest.html
    manifest.yml
    nivo-slider
    rails-782b548cc1ba7f898cdad2d9eb8420d2.png
    rails.png
    span-e0c8cec2b154f8e9ed9c4b4328e213db.png
    span.png
    style-99b20730adaa724e191f1fae8f56c9b1.css
    style-99b20730adaa724e191f1fae8f56c9b1.css.gz
    style.css
    style.css.gz
    001.gif
    001-d6ff44aa2840e4f4f05282bf4599310b.gif
    
    
    mainifest.yml:
    
    
    ---
    001.gif: 001-d6ff44aa2840e4f4f05282bf4599310b.gif
    002.gif: 002-bc639f997930393c59f64725642b0c09.gif
    003.gif: 003-1800c606f75c43be214a6e5c281c9e18.gif
    004.gif: 004-0e4cbcce4459921aefefd6acbb5cc9ea.gif
    005.gif: 005-ffd3a35ce21cdf3dd8b406aea1fcf0b6.gif
    006.gif: 006-ca426e93b42000e5b4b9dc64aa4e8605.gif
    007.gif: 007-749e5c95f6d95aae33fbebed8eb1e773.gif
    008.gif: 008-3f90af7063b58a8ddb367f64e28ebc7c.gif
    009.gif: 009-bc0e0731e6ce8827368f20646ad65272.gif
    010.gif: 010-740fe514a21283dfe61702f66062a54a.gif
    011.gif: 011-af9bd92a1498743d38cedc3bbcc1b9f2.gif
    012.gif: 012-2b0806af8fd9ad4ffae206aaad4b61b9.gif
    013.gif: 013-627175aff829d525bb5d0793dc345e3d.gif
    014.gif: 014-97d9f63875ad1c3b495c4f61fb683f7e.gif
    015.gif: 015-20e9b89c7bf1471ef1aab075331d801a.gif
    016.gif: 016-3b0783c92695ad8604005cb9e610a55d.gif
    
    rails.png: rails-782b548cc1ba7f898cdad2d9eb8420d2.png
    span.png: span-e0c8cec2b154f8e9ed9c4b4328e213db.png
    application.js: application-376598dc6b01c22c358813b48e8ffeaf.js
    ingo.js: ingo-77eddf4f547c4b1e9db84bfbef2cc14a.js
    jstest.html: jstest-aa3ac1b728fbaa633fdfd9243a1c1bc8.html
    nivo-slider/demo/demo.html: nivo-slider/demo/demo-f16637c5f2a152a33ba7b722243b9637.html
    nivo-slider/demo/images/nemo.jpg: nivo-slider/demo/images/nemo-29a0982d3593f5d88414871ffeacc9a7.jpg
    nivo-slider/demo/images/toystory.jpg: nivo-slider/demo/images/toystory-5ae5d6ce9bfc7ee016f7f1be1d517233.jpg
    nivo-slider/demo/images/up.jpg: nivo-slider/demo/images/up-213326f8b51ecafb1ca83fd2eff9a165.jpg
    nivo-slider/demo/images/walle.jpg: nivo-slider/demo/images/walle-030eb031b9e5541c7cae261d41d867eb.jpg
    nivo-slider/themes/default/arrows.png: nivo-slider/themes/default/arrows-704b615a2a6e7df530ba52c76c8c0f44.png
    nivo-slider/themes/default/bullets.png: nivo-slider/themes/default/bullets-54f88df4746f9d2d537d8d70689c00f3.png
    nivo-slider/themes/default/loading.gif: nivo-slider/themes/default/loading-2e31847824e8baa0b404a658ec39a708.gif
    application.css: application-380a64fb011e4afb121d4fc16c958c38.css
    ingo.css: ingo-c2060dfa713e84f751926a58bb416cae.css
    style.css: style-99b20730adaa724e191f1fae8f56c9b1.css
    

    始终提示 ActionView::Template::Error (ingo.js isn't precompiled) 在 public /assets 下已经有了 ingo.js 啊。。

  • 部署到生产模式的问题 at 2012年02月29日

    @piginzoo 你的步骤我都做了,还是不行。 抛开 js,css 不错,我新建立一个项目仅仅放一张 jpg 在 app/assets/images 下面,然后 rake assets:precompile 该图片拷贝到了/public/assets 下面 页面引用是<%=image_tag 1.jpg%> 在开发模式能显示,用 rails s -e production 后 图片不能显示,链接倒是/assets/1.jpg 哦,唉,搞不懂了..

  • 部署到生产模式的问题 at 2012年02月28日

    有谁知道啊?

  • 部署到生产模式的问题 at 2012年02月27日

    从新创建了一个项目,在 index.html.erb 中放了一个 1.jpg,1.jpg 放在 app/assets/images 下面,在开发模式启动访问正常,图片出来了,通过 rake assets:precompile,1.jpg 被拷贝到了 /public/assets 下面,并且还有个 1-sdfsfsfsfsdfsd.jpg 的图片。 用 rails s -e production 启动访问,图片显示不出来,啥原因呢?

  • 部署到生产模式的问题 at 2012年02月27日

    Public/assets中是有了,我把引用全换成application后没500了,但是显示出网页没样式也没图片我看路径都是 /assets/222-edgtggt.jpg 这种的 但是却找不到

  • 部署到生产模式的问题 at 2012年02月27日

    在生产模式后把引用 style.css 改成 application 没报错了,难道我还需要手动改一次?

  • 部署到生产模式的问题 at 2012年02月26日

    @piginzoo 我的文件其实就是 <%= stylesheetlink_tag "style.css","ingo.css" %> 这样写的,所以开发模式没问题.. 想问下,在生产中就用开发模式方式有什么问题?无非没有进行 CSS、JS 这些优化嘛?

  • 部署到生产模式的问题 at 2012年02月25日

    有,style.css 的内容放入 application.css 中了。当然没有单独的 style.css 了

  • 部署到生产模式的问题 at 2012年02月25日

    @shawnyu 我说了嘛,config.assets.precompile += ['style.css'] 我已经加了,命令 rake assets:precompile 也执行了,没报错,但是访问网站就 500 了,并且报那个错误。

  • 直接修改密码用 account/edit?

  • 呵呵,原来这样,了解了解...

  • reset_password_token 怎么变成 resetpasswordtoken?

  • 这个不错...

  • 我们不应该排斥 Windows at 2012年02月09日

    今天在 WIN 下跑项目,一会直接崩溃,我还以为程序问题,就把项目拿回家,在 OSX 下试,结果没任何问题....NND

  • 提示 EMAIL 不能为空 这个问题好解决,是因为表中有 email 字段,页面上没有,如果把相关配置都改成 username,在表里干掉 email,那么就直接报 undefined email method..已经不用 email 字段来验证了还报这个。。

  • @ywencn 如果不拿掉,我注册表单保存的时候,没有 EMAIL 字段了,会提示 EMAIL 不能为空,问题是我想用 USERNAME 代替 EMAIL 字段啊

  • @lainuo 请问这个跟迁移有什么关系?我不是 2.0 我要实现用 username 来注册而不是 email.但是一直都不行,始终提示 undefined email method..NND..email 啥时候变方法了..唉..换个字段咋都这麻烦呢..

  • 哈哈 gentoo 好

  • 学习一个

  • GitHub 的产品设计 at 2012年02月02日

    好文章

  • 双枪

  • 问题已经解决。 rvm install 1.9.3-p0 --with-gcc=clang 搞定。 但是运行 rvm use xx 后报 RVM is not a function, selecting rubies with 'rvm use ...' will not work.

    需要退出终端,或执行 bash /etc/rvmrc 才行

  • 是啊

  • 通过 brew 安装了 libyaml 看了下 configure.log 提示 configure: WARNING: unrecognized options: --with-libyaml checking build system type... x86_64-apple-darwin11.2.0 checking host system type... x86_64-apple-darwin11.2.0 checking target system type... x86_64-apple-darwin11.2.0 checking whether the C compiler works... no configure: error: in `/Users/yfeng/.rvm/src/ruby-1.9.3-p0': configure: error: C compiler cannot create executables

    奇怪...还要装啥呢??

  • 感谢