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!
-
<% @software_ci.errors.each_full do |message| %>
- <%= message %> <% 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?