diff --git a/app/controllers/crops_controller.rb b/app/controllers/crops_controller.rb index 48f8342f0..2b5e2f22e 100644 --- a/app/controllers/crops_controller.rb +++ b/app/controllers/crops_controller.rb @@ -146,6 +146,6 @@ class CropsController < ApplicationController private def crop_params - params.require(:crop).permit(:en_wikipedia_url, :name, :parent_id, :creator_id, :scientific_names_attributes) + params.require(:crop).permit(:en_wikipedia_url, :name, :parent_id, :creator_id, :scientific_names_attributes => [:scientific_name]) end end diff --git a/config/environments/staging.rb b/config/environments/staging.rb index d8f0e530c..150c62d8c 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -1,6 +1,8 @@ Growstuff::Application.configure do # Settings specified here will take precedence over those in config/application.rb + config.action_controller.action_on_unpermitted_parameters = :raise + # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both threaded web servers # and those relying on copy on write to perform better. diff --git a/spec/features/crops/crop_wranglers_spec.rb b/spec/features/crops/crop_wranglers_spec.rb index 26259e3a9..0e0b08fbe 100644 --- a/spec/features/crops/crop_wranglers_spec.rb +++ b/spec/features/crops/crop_wranglers_spec.rb @@ -43,8 +43,10 @@ feature "crop wranglers" do click_link 'Add Crop' fill_in 'Name', with: "aubergine" fill_in 'Wikipedia URL', with: "http://en.wikipedia.org/wiki/Maize" + fill_in 'crop_scientific_names_attributes_0_scientific_name', with: "planticus maximus" click_on 'Save' expect(page).to have_content 'Crop was successfully created' + expect(page).to have_content 'planticus maximus' end end