我正在尝试使用 rails 创建一个简单的 micropost 应用程序...
这是我的模型:
Class Micropost < ActiveRecord::Base
attr_accessible :content, :name
end
控制器:
class MicropostsController < ApplicationController
def create
@blog=Micropost.new( :content => params[:content])
@blog.save
redirect_to microposts_show_path
end
def show
@mblg=Micropost
end
def index
end
end
意见:
create.html.erb
<h1>Microblogs#create</h1>
<p></p>
<%= label_tag(:content) %><br/>
<%= text_field_tag (:content) %><br/>
<%= submit_tag("submit") %><br/>
index.html.erb
<h1>Microblogs#index</h1>
<p>Find me in app/views/microblogs/index.html.erb</p>
show.html.erb
<h1>Microblogs#show</h1>
<p></p>
<%= @mblg.each.do |variable|%>
<p><%= variable.content %></p>
<%end%>
路由.rb
Blog::Application.routes.draw do
get "microposts/create"
get "microposts/show"
get "microposts/index"
end
我收到模板丢失错误...这是一个相当简单的应用程序...您能指出我哪里出错了吗?