coordinates GET /coordinates(.:format) coordinates#index
POST /coordinates(.:format) coordinates#create
new_coordinate GET /coordinates/new(.:format) coordinates#new
edit_coordinate GET /coordinates/:id/edit(.:format) coordinates#edit
coordinate GET /coordinates/:id(.:format) coordinates#show
PUT /coordinates/:id(.:format) coordinates#update
DELETE /coordinates/:id(.:format) coordinates#destroy
tweets_search GET /tweets/search(.:format) tweets#search
tweets_index GET /tweets/index(.:format) tweets#index
class TweetsController<ApplicationController
def index
#include 'coordinates_controller.rb'
include SearchHelper
include ParamasHelper
@sql=a.search
@tweets=Tweets.paginate_by_sql(sql, :@page, :per_page => @per_page ).all
end
end
私の Rails アプリには、 と という名前の 2 つのテーブルがCoordinates
ありTweets
ます。レンダリングするアクションが 4 つあります。
私のroutes.rb
ファイル
Tweetsblog2::Application.routes.draw do
resources :tweets, :coordinates
get "tweets/show"
get "tweets/index"
match "/tweets/show" => "tweets#show"
match "/tweets/index" => "tweets#index"
に移動するたびに、代わりに http://localhost:3000/tweets
表示され、同じエラーが別の名前で表示されます。tweets/index
tweets/show
に移動するとhttp://localhost:3000/tweets/show
、 が表示されArgumentError in TweetsController#show
ます。
同じものhttp://localhost:3000/tweets/index
を提供する場所に移動するとArgumentError in TweetsController#show
私のコードshow.html.erb
:
<%= form_tag({controller: "tweets", action:"index" }, method: "get") do %>
<%= label_tag(:search, "search for:") %>
<%= text_field_tag(:show) %>
<%= text_field_tag(:search) %>
<%= submit_tag("get results ") %>
<% end %>
私のコードindex.html.erb
:
<%= will_paginate @tweets %>
<% @tweets.each do |tweets| %>
<ul>
<li><%= tweets.id %></li>
<li><%= tweets.tweet_created_at %></li>
<li><%= tweets.tweet_id %></li>
<li><%= tweets.tweet_source %></li>
<li><%= tweets.tweet_text %></li>
<li><%= tweets.user_id %></li>
<li><%= tweets.user_name %></li>
<li><%= tweets.user_sc_name %></li>
<li><%= tweets.user_loc %></li>
<li><%= tweets.user_img %></li>
<li><%= tweets.longitude %></li>
<li><%= tweets.latitude %></li>
<li><%= tweets.place %></li>
<li><%= tweets.country %></li>
<% end %>
</ul>
適切なページにルーティングされていません。私を助けてください、私はこれで立ち往生しています。