I have a form for creating new Missions with an Admin account. Each Mission is linked to an account. When I visit admin/missions/new I get an error "ArgumentError in Admin::Missions#new". Can anyone point to what I'm doing wrong?
When I checked the rails console a mission id and name does show up, but I guess I'm missing the Admin for the mission.
Here's my Controller
class Admin::MissionsController < Admin::ApplicationController
def index
@missions = missions
end
def new
@mission = current_account.missions.new(params[:mission])
@mission.save
end
def create
render plain: params[:mission].inspect
end
def edit
@mission = missions.find(params[:id])
end
private
def missions
@missions ||= current_account.missions
end
end
Here's my form
<%= form_with [:admin, @mission] do |f| %>
<div>
<label>Name</label>
<%= f.text_field :name %>
</div>
<div>
</div>
<div>
<%= f.submit %>
</div>
<% end %>
I'm expecting the url admin/missions/new to take me to the form, but I I get the argument error wrong number of arguments (given 1, expected 0)