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 <h1>Add new article</h1> <% form_tag :action => ''create'' do %> <p><label>Title</label>: <%= text_field ''article'', ''title'' %></p> <p><label>Body</label>: <br /> <%= text_area ''article'', ''body'' %></p> <p><label>Date</label>: <%= text_field ''article'', ''date'' %></p> <p><label>Tag</label>: <%= text_field ''article'', ''tag'' %></p> <%= submit_tag "Create" %> <% end %> <%= link_to ''Back'', {:action => ''list''} %> ------ please help :( -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 28 Jan 2009, at 21:14, Rt Rr wrote:> > > 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'') >sounds like you''ve got a unique index somewhere. Fred --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung wrote:> On 28 Jan 2009, at 21:14, Rt Rr wrote: > >> ''2008-03-02'', >> ''tttt'') >> > sounds like you''ve got a unique index somewhere. > > Fredit''s work now :) thx very much Fred -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---