I have the following model
==========================
class SoftwareCi < ActiveRecord::Base
has_one :ci, :as => :content
has_one :primary_group
validates_presence_of :name, :message => "can''t be
empty"
end
The controller
===============
def create
@software_ci= SoftwareCi.new(params[:ci])
redirect_to :action => ''create_ui''
end
The rhtml, create_ui, I have given the following
======================
<% unless @software_ci.errors.empty? %>
Error occurred!
<ul>
<% @software_ci.errors.each_full do |message| %>
<li><%= message %></li>
<% end %>
</ul>
<% end %>
The problem
===============I get the following error in the view
You have a nil object when you didn''t expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.errors
Could you please help me?
--
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
-~----------~----~----~----~------~----~------~--~---