2011-10-10 57 views
1

我做的文件夹中称为谷歌标志物公共/图像,但是当我去如何使用图像的子文件夹在Rails项目

http://myproject/images/google-markers/mymarker.png 

我得到这个错误:

No route matches "/images/google-markers/mymarker.png" 

它看来,我不能在我的项目中使用图像的子文件夹。当我在我的图像文件夹中使用直接图像时,一切正常。

谢谢你的帮忙!

PS:我用的部署乘客,它在轨道上3.0.9开发版本

编辑:

我config.ru:

# This file is used by Rack-based servers to start the application. 

require ::File.expand_path('../config/environment', __FILE__) 
run Hotelandlodge::Application 

和我development.rb : Hotelandlodge :: Application.configure do #此处指定的设置优先于config/application.rb中的设置

# In the development environment your application's code is reloaded on 
    # every request. This slows down response time but is perfect for development 
    # since you don't have to restart the webserver when you make code changes. 
    config.cache_classes = false 

    # Log error messages when you accidentally call methods on nil. 
    config.whiny_nils = true 

    # Show full error reports and disable caching 
    config.consider_all_requests_local  = true 
    config.action_view.debug_rjs    = true 
    config.action_controller.perform_caching = false 

    # Don't care if the mailer can't send 
    config.action_mailer.raise_delivery_errors = false 

    # Print deprecation notices to the Rails logger 
    config.active_support.deprecation = :log 

    Paperclip.options[:command_path] = "/usr/local/bin/" 

    # Only use best-standards-support built into browsers 
    config.action_dispatch.best_standards_support = :builtin 

    end 

我的config/application.rb中:

require File.expand_path('../boot', __FILE__) 

    require 'rails/all' 

    # If you have a Gemfile, require the gems listed there, including any gems 
    # you've limited to :test, :development, or :production. 
    Bundler.require(:default, Rails.env) if defined?(Bundler) 

    module Hotelandlodge 
    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. 

     # Custom directories with classes and modules you want to be autoloadable. 
     # config.autoload_paths += %W(#{config.root}/extras) 

     # Only load the plugins named here, in the order given (default is alphabetical). 
     # :all can be used as a placeholder for all plugins not explicitly named. 
     # config.plugins = [ :exception_notification, :ssl_requirement, :all ] 

     # Activate observers that should always be running. 
     # config.active_record.observers = :cacher, :garbage_collector, :forum_observer 

     # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 
     # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 
     # config.time_zone = 'Central Time (US & Canada)' 

     # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 
     # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 
     # config.i18n.default_locale = :de 

     # JavaScript files you want as :defaults (application.js is always included). 
     # config.action_view.javascript_expansions[:defaults] = %w(jquery rails) 

     # Configure the default encoding used in templates for Ruby 1.9. 
     config.encoding = "utf-8" 

     # Configure sensitive parameters which will be filtered from the log file. 
     config.filter_parameters += [:password] 
    end 
    end 

我的Gemfile:

source 'http://rubygems.org' 

    gem 'rails', '3.0.9' 

    # Bundle edge Rails instead: 
    # gem 'rails', :git => 'git://github.com/rails/rails.git' 

    gem 'mysql2', '< 0.3' 
    gem "paperclip", "~> 2.4" 

    gem 'activeadmin' 
    gem 'will_paginate' 

    # Use unicorn as the web server 
    # gem 'unicorn' 

    # Deploy with Capistrano 
    # gem 'capistrano' 

    # To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+) 
    # gem 'ruby-debug' 
    # gem 'ruby-debug19', :require => 'ruby-debug' 

    # Bundle the extra gems: 
    # gem 'bj' 
    # gem 'nokogiri' 
    # gem 'sqlite3-ruby', :require => 'sqlite3' 
    # gem 'aws-s3', :require => 'aws/s3' 

    # Bundle gems for the local environment. Make sure to 
    # put test-only gems in this group so their generators 
    # and rake tasks are available in development mode: 
    # group :development, :test do 
    # gem 'webrat' 
    # end 
+0

您使用的是rails 3.1吗? –

+0

不,我正在使用3.0.9 – Sebastien

+0

你的config/routes.rb文件是什么? –

回答

0

你加路径routes.rb中?

相关问题