0

Ruby on Rails は初めてで、独自の Ruby on Rails を作成しています - ブログ... ツイート用に自作の Scaffold を作成しています...

新しい投稿のために送信ボタンを押しても..次のエラーメッセージが表示されます。

uninitialized constant PostsController

ここに私のファイルがあります:

new.html.erb

<h1>Add a new Tweet</h1>
 <%= form_for(@post) do |f| %>

 <div class="field">
   <%= f.label :title %><br />
   <%= f.text_field :title %>
 </div>
 <div class="field">
   <%= f.label :content %><br />
   <%= f.text_area :content %>
  </div>
  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>

blog_controller.rb

class BlogController < ApplicationController
def new
    @post = Post.new
end
def create
    @post = Post.new(params[:post])
    redirect_to @post
 end
end

ルート.rb

Me::Application.routes.draw do
 resources :posts
 resources :post
 match '/' => 'blog#home'
 match '/archiv' => 'blog#archiv'
 match '/tweets' => 'blog#new'

 root :to => 'blog#home'
end

次の構文でモデルを作成しました。

rails g model post title:string content:text

そして少なくともrake db:migrate

4

1 に答える 1