With the code below and entry is created in the venuetypes table with the correct *venue_id* and time stamps however, the type column remains as null
def new
@new1 = "gfdsgfd"
@venue = Venue.new
@venue.save
@venuetype = @venue.venuetypes.create(:type => "test")
@venuetype.save
respond_to do |format|
format.html # new.html.erb
format.json { render json: @venue }
end
end
Unless you’ve specified otherwise, rails expects a
typecolumn to be used for single table inheritance which is probably causing problems.Also,
venuetypes.createwill only save the venue type if it is created successfully, as will the.savecall afterwards. You have almost certainly got an error on the venue type which is causing it not to be saved. Try using.save!which will throw an error or by lookins at@venuetype.errorswhich will contain any error messages that have caused it not to be saved.