Q:

Why is my controller not saving my object in the database?

I am saving an entry object for CalendarEntry which is my model, but in the view when I click "Done" for some reason the object doesn't save.
In my point of view my controller is fine, but maybe the issue is there:

Controller

def create
  @entry = CalendarEntry.new(entries_params)
  binding.pry
  if @entry.save
    render 'admins/calendar_entries/index'
  else
    render 'admins/calendar_entries/new'
  end
end

def entries_params
  conversions
  params.require(:calendar_entry).permit(:entry_type, :entry_level, :visible, :title, :publication_date, :expiration_date, :content, :phonenumber, :website, :state, :city, :address)
end

def conversions
  params[:calendar_entry][:entry_type] = params[:calendar_entry][:entry_type].to_i
  params[:calendar_entry][:entry_level] = params[:calendar_entry][:entry_level].to_i
end

Console

As you see in the console is asking me for two values "calendar_categories" and "calendar_entry_categories", but how it's supposed to ask it because my "CalendarEntry" only ask for the values in there, 
P.D. The id, created_at and  updated_at is generated automatically.

Update July/17 - 11:12pm

Schema defined here:
create_table "calendar_categories", force: :cascade do |t|
    t.string "name"
    t.string "description"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "calendar_entries", force: :cascade do |t|
    t.integer "entry_type"
    t.integer "entry_level"
    t.boolean "visible"
    t.string "title"
    t.datetime "publication_date"
    t.datetime "expiration_date"
    t.text "content"
    t.string "phonenumber"
    t.string "website"
    t.string "state"
    t.string "city"
    t.string "address"
    t.string "profile_picture"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
  end

  create_table "calendar_entry_categories", force: :cascade do |t|
    t.bigint "calendar_entry_id"
    t.bigint "calendar_category_id"
    t.datetime "created_at", null: false
    t.datetime "updated_at", null: false
    t.index ["calendar_category_id"], name: "index_calendar_entry_categories_on_calendar_category_id"
    t.index ["calendar_entry_id"], name: "index_calendar_entry_categories_on_calendar_entry_id"
  end

Model defined here:
class CalendarEntry < ApplicationRecord
 scope :visible, -> { where(visible: true) }
 scope :invisible, -> { where(visible: false) }
 scope :expired, -> { where('expiration_date < ?', Time.zone.now) }
 scope :active, -> { where('expiration_date >= ?', Time.zone.now) }

 has_many :calendar_entry_categories, dependent: :destroy
 has_many :calendar_categories, through: :calendar_entry_categories

 enum entry_type: %i[event program]
 enum entry_level: %i[municipal statal federal injuve]

 mount_uploader :profile_picture, CalendarEntryProfilePictureUploader

 validates :entry_type, :entry_level, :visible, :title,
        :expiration_date, :content, :phonenumber, :website, :state, :city,
        :address, :calendar_categories,
        :calendar_entry_categories, presence: true
 validates :publication_date, presence: true, on: :update
 validates :title, uniqueness: true
 validates :phonenumber, numericality: { only_integer: true }
 validates :phonenumber, length: { is: 10 }
 validates_inclusion_of :entry_type, in: CalendarEntry.entry_types
 validates_inclusion_of :entry_level, in: CalendarEntry.entry_levels
 validate :expiration_date_range

 before_validation :init, on: :create

 private

 def init
   self.publication_date ||= Time.zone.now
 end

 def expiration_date_range
   return if !expiration_date.nil? && expiration_date > publication_date
   errors.add(:expiration_date, :past_expiration_date)
 end
end

A:

It looks like you're trying to validate the presence of calendar_categories and calendar_entry_categories in your model validations. 
You won't be able to validate their presence, considering a CalendarEntryCategory cannot exist until a CalendarEntry exists, and a CalendarCategory might not always exist when a CalendarEntry is created.
Therefore, to get this to work, all you should have to do is remove 
:calendar_categories, :calendar_entry_categories from the presence: true validations in your CalendarEntry model.

