я делаю тест ajax (потому что я такой новый в ajax), чтобы отправить данные из представления welcome (index.html.erb) в контроллер (welcome_controller.rb), но все время, которые я пробовал показыватьмне та же ошибка:
с тем же изменением: 
но я не знаю, что это значит, и всевремена, когда представление показывает мне предупреждение «ошибка» (error), когда я делаю запрос.
вот что я сделал в представлении:
<%= javascript_include_tag "application" %>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
$(document).ready(function(){
$("#petition").click(function(){
$.ajax({
url: 'http://192.168.99.100:3000/welcome_controller/index/',
type: 'POST',
dataType: 'json',
data: { max_id: {id: "5"} },
success: function (data) {
alert("success");
},
error: function(xhr, status, error) {
alert(xhr+status+error); \\to take the second photo i change this for this "alert(JSON.stringify(xhr));"
}
});
});
});
вот мои маршруты.rb:
Rails.application.routes.draw do
resources :welcome do
collection do
get 'index'
end
end
get 'welcome/page'
root 'welcome#index'
get 'menu/index'
end
вот я application.js:
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's
// vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file. JavaScript code in this file should be added after the last require_* statement.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require tinymce
//= require rails-ujs
//= require turbolinks
//= require_tree .
и вот гем ruby:
# frozen_string_literal: true
source 'https://rubygems.org'
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/')
"https://github.com/#{repo_name}.git"
end
#propiedades de usuario
gem 'devise', '~> 4.4', '>= 4.4.1'
#text editor to post with link and imagens
gem 'tinymce-rails'
#admin y moderator
gem 'cancancan'
gem 'rolify'
#votar like y dislike
gem 'acts_as_votable', '~> 0.11.1'
#consultas rails para mesclar con js
gem 'jquery-rails'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.5'
# Use postgresql as the database for Active Record
gem 'pg', '>= 0.18', '< 2.0'
# Use Puma as the app server
gem 'puma', '~> 3.7'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: %i[mri mingw x64_mingw]
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '~> 2.13'
gem 'selenium-webdriver'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'listen', '>= 3.0.5', '< 3.2'
gem 'web-console', '>= 3.3.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
имя моего контроллера: welcome_controller.RB и 2 индекса метода и шоу я все равно поставлю контроллер:
class WelcomeController < ApplicationController
before_action :set_welcome, only: [:show]
protect_from_forgery :except => :receive_guest
helper_method :current_or_guest_user
def index
puts params[:max_id]
end
def show
end
end