0

I'm trying to create new availability object in a program and all of the sudden I can't find availabilities_params. Not sure what is going on exactly.

class AvailabilitiesController < ApplicationController

def create
    @availability = Availability.new(availability_params)
    @availability.save

    if member_signed_in?
      redirect_to member_path(current_member)
    elsif provider_signed_in?
      redirect_to provider_path(current_provider)
    end

end

def new
    @availability = Availability.new
end

def show
    @availability
end

private

def availabilty_params
    params.require(:availability).permit(:time, :date, :provider_id, :user_id)
end


end

Here is the form to create availability

= form_for(@availability) do |f|
   =    f.date_field :date, :min=> "2014-11-00", :value => "2015-01-01"
   = f.time_field :time, :placeholder => "Available Time"
   -if member_signed_in?
     = f.hidden_field :member_id, value: current_member.id
   -elsif provider_signed_in?
     = f.hidden_field :provider_id, value: current_provider.id
= f.submit

2 Answers2

2

You got a typo in the method name. It should be def availability_params rather than def availabilty_params.

fivedigit
  • 18,464
  • 6
  • 54
  • 58
0

In your create action, you had this

 @availability = Availability.new(availability_params)

In your availability_params method you had this

def availabilty_params
    params.require(:availability).permit(:time, :date, :provider_id, :user_id)
end

Please changeavailabilty_params to availability_params

Darkmouse
  • 1,941
  • 4
  • 28
  • 52