Guest User

Untitled

a guest
Jun 21st, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. def create
  2. @state = State.new(params[:state])
  3. @state.tags = params[:tags].map {|tag| Tag.find_by_id tag}
  4.  
  5. respond_to do |format|
  6. if @state.save
  7. flash[:notice] = 'State was successfully created.'
  8. format.html { redirect_to(@state) }
  9. format.xml { render :xml => @state, :status => :created, :location => @state }
  10. else
  11. format.html { render :action => "new" }
  12. format.xml { render :xml => @state.errors, :status => :unprocessable_entity }
  13. end
  14. end
  15. end
  16.  
  17.  
  18. ActiveRecord::StatementInvalid in StatesController#create
  19.  
  20. Mysql::Error: Duplicate entry '1' for key 'PRIMARY': INSERT INTO states_tags (`updated_at`, `tag_id`, `id`, `state_id`, `created_at`) VALUES ('2009-06-12 10:59:01', 1, 1, 18, '2009-06-12 10:59:01')
  21.  
  22. RAILS_ROOT: C:/rails/webstate
Add Comment
Please, Sign In to add comment