没有路由匹配Rails中的错误

时间:2016-07-01 09:54:16

标签: ruby-on-rails

我收到以下错误

  

没有路线匹配{:action =>“index”,   :控制器=> “中的模块/管理/订单”}

使用以下内容时:

var gulp = require('gulp'),
    autoPrefixer = require('gulp-autoprefixer'),
    jade = require('gulp-jade'),
    liveReload = require('gulp-livereload'),
    sourceMaps = require('gulp-sourcemaps'),
    ts = require('gulp-typescript'),
    tsLint = require('gulp-tslint'),
    watch = require('gulp-watch'),
    sass = require('gulp-sass');

// Configuration
var config = {
    js: 'public/_assets/frontend/js',
    css: 'public/_assets/frontend/css',
    fonts: 'public/_assets/frontend/fonts',
    images: 'public/_assets/frontend/img',
    markup: 'public/'
};

// Javascript
gulp.task('scripts', function() {
    var tsResult = gulp.src(['src/ts/*.ts', 'src/ts/**/*.ts'])
        .pipe(tsLint())
        .pipe(ts({
            noImplicitAny: true
        }));

        tsResult.js
            .pipe(gulp.dest(config.js))
            .pipe(liveReload());
});

// Sass
gulp.task('sass', function() {
    return gulp.src(['src/sass/*.scss', 'src/sass/**/*.scss'])
        .pipe(watch(['src/sass/*.scss', 'src/sass/**/*.scss']))
        .pipe(sourceMaps.init())
        .pipe(sass.sync().on('error', sass.logError))
        .pipe(autoPrefixer({
            browsers: ['last 3 versions'],
            cascade: false
        }))
        .pipe(sourceMaps.write())
        .pipe(gulp.dest(config.css))
        .pipe(liveReload());
});

// jade
gulp.task('markup', function() {
    return gulp.src(['src/**/*.jade', 'src/**/_*.jade'])
        .pipe(jade({
            pretty: true
        }))
        .pipe(gulp.dest(config.markup))
        .pipe(liveReload());
});

// Images
gulp.task('images', function() {
    return gulp.src(['src/images/**/*.*', 'src/images/*.*'])
        .pipe(gulp.dest(config.images));
});

// Watch
gulp.task('watch', function() {
    liveReload.listen();
    gulp.watch(['src/ts/*.ts', 'src/ts/**/*.ts'], ['scripts']);
    gulp.watch(['src/sass/*.scss', 'src/sass/**/*.scss'], ['sass']);
    gulp.watch(['src/*.jade', 'src/**/*.jade'], ['markup']);
});

// Default Task
gulp.task('default', function() {
    gulp.start('sass', 'scripts', 'markup', 'images', 'watch');
});

我的路线有这条道路:

<%= form_tag({ :action => :index}, { :method => "get" }) do %>

我尝试在admin_orders GET /new/admin/orders(.:format) module/admin/orders#index 中运行此代码,它可以正常运行:

rails console

我的应用程序正在使用r.url_for :controller => 'module/admin/orders', :action=> :index, :id=>42 => "http://domain.com/new/admin/orders?id=42" r.url_for :controller => 'module/admin/orders', :action=> :index => "http://domain.com/new/admin/orders" ,此控制器继承Spree

2 个答案:

答案 0 :(得分:0)

用户正确的网址助手屁股跟随

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

<item
    android:id="@+id/fb_resizeBtn"
    android:drawable="@mipmap/fb_logo"
    android:width="15dp"
    android:height="15dp"
    />

</layer-list>

答案 1 :(得分:0)

答案是将路由配置放在同一引擎控制器中(例如,在这种情况下为Spree):

Spree::Core::Engine.add_routes do scope 'module/' do namespace :admin, as: 'module_admin' do resources :orders, controller: '/module/admin/orders', only: [:edit, :index, :update] end end

并使用:

<%= form_tag(module_admin_orders_path, method: :get) %>

或使用带引擎前缀的网址助手:

<%= form_tag(main_app.admin_orders_path, method: :get) %>