hello , I am designing a project for a news website and I am new to ROR
I am facing a problem with the add news function
this is the error
Mysql::Error: Duplicate entry ‘’ for key 1: INSERT INTO articals
(body
, title
, date
, tag
) VALUES(‘nnn’, ‘llllhhh’, ‘2008-03-02’,
‘tttt’)
this is my code
class ArticleController < ApplicationController
def new
@article = Article.new
@article.date = Date.today
end
def create
@article = Article.new(params[:article])
if @article.save
redirect_to :action => ‘list’
else
render :action => ‘new’
end
end
add.rhtml in views
Add new article
<% form_tag :action => 'create' do %>Title: <%= text_field 'article', 'title' %>
Body:
<%= text_area 'article', 'body' %>
Date: <%= text_field 'article', 'date' %>
Tag: <%= text_field 'article', 'tag' %>
<%= submit_tag “Create” %>
<% end %>
<%= link_to ‘Back’, {:action => ‘list’} %>
please help