Handle sign-up failure fails - html

I did make a attribute called address before . But I didn't use it in the sign up form . When I input all text field in sign up form , it flashes the error
The form contains 1 error.
Address can't be blank
Any other places I should check with ?
Controller
def new
#tutor = Tutor.new
end
def create
#tutor = Tutor.new(tutor_params)
if #tutor.save
log_in #tutor
flash[:success] = "Congratulations! Your registration is successful!"
redirect_to #tutor
else
render 'tutors/new'
end
end
# Handle sign-up failure, to redirect the tutor to the registeration form again
def tutor_params
params.require(:tutor).permit(:name, :email, :password, :password_confirmation,:gender
,:education_level,:institution,:exprience,:district,:subject,:student_level)
end
Sign Up page
<%= form_for(#tutor) do |f| %>
<%= render 'shared/error_messages' %>
<%= f.label :name %>
<%= f.text_field :name, class: 'form-control' %>
<%= f.label :email %>
<%= f.text_field :email, class: 'form-control' %>
<%= f.label :password %>
<%= f.password_field :password, class: 'form-control' %>
<%= f.label :password_confirmation, "Confirm Password" %>
<%= f.password_field :password_confirmation, class: 'form-control' %>
<%= f.label :gender %>
<%= f.select(:gender, ['Male', 'Female'] , class: 'form-control' )%>
<%= f.label :tutor_education_level %>
<%= f.select(:education_level, ['Bachelor', 'Master', 'Doctor'] , class: 'form-control' )%>
<%= f.label :tutor_institution %>
<%= f.text_field :institution, class: 'form-control' %>
<%= f.label :tutorial_experience %>
<%= f.text_field :experience, class: 'form-control' %>
<%= f.label :tutor_preferred_district %>
<%= f.text_field :district, class: 'form-control' %>
<%= f.label :tutor_preferred_subject %>
<%= f.text_field :subject, class: 'form-control' %>
<%= f.label :tutor_required_student_level %>
<%= f.select(:student_level, ['P1-P3', 'P4-P6', 'S1-S3', 'S4-S6'] , class: 'form-control' )%>
<%= f.submit "Create tutor's account", class: "btn btn-primary" %>
<% end %>
_error_messages.html.erb
<% if #tutor.errors.any? %>
<div id="error_explanation">
<div class="alert alert-danger">
The form contains <%= pluralize(#tutor.errors.count, "error") %>.
</div>
<ul>
<% #tutor.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
db/schema.rb(uupdate)
create_table "tutors", force: :cascade do |t|
t.string "name"
t.string "email"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "password_digest"
t.string "address"
t.string "remember_token"
t.string "gender"
t.string "education_level"
t.string "institution"
t.integer "experience"
t.string "district"
t.string "subject"
t.string "student_level"
end
add_index "tutors", ["email"], name: "index_tutors_on_email", unique: true
add_index "tutors", ["remember_token"], name: "index_tutors_on_remember_token"
end
tutor.rb (update2)
`class Tutor < ActiveRecord::Base
before_save {self.email = email.downcase}
before_save :create_remember_token
validates :name, presence: true, length: { maximum: 50}
VALID_EMAIL_REGEX = /\A[\w+\-.]+#[a-z\d\-.]+\.[a-z]+\z/i
validates :email, presence: true, format: { with: VALID_EMAIL_REGEX },
uniqueness: { case_sensitive: false }
validates :password, presence: true, length: { minimum: 6 }
validates :password_confirmation, presence: true
has_secure_password
validates :address, presence: true, length: {maximum: 100}
def create_remember_token
self.remember_token = SecureRandom.urlsafe_base64
end
end
`

Change
validates :address, presence: true, length: {maximum: 100}
to
validates :address, length: {maximum: 100}
in your model tutor.rb
You are validating for the presence of address field in your model while creating a tutor, but you are not passing address params.
If you want to delete existing address field from db,
In your terminal, do
rails g migration remove_address_from_tutors
Add the following code in your newly created migration file
class RemoveAddressFromTutors < ActiveRecord::Migration
def change
remove_column :tutors, :address
end
end
and then do rake db:migrate in your terminal

def create
#tutor = Tutor.new(tutor_params)
if #tutor.save
log_in #tutor
flash[:success] = "Congratulations! Your registration is successful!"
redirect_to #tutor
else
flash[:tutor] = #tutor
redirect_to new_tutor_path
end
end
Also make sure your validates_presence_of :address in your tutor model.

Related

How to capture value from application and store in database table

I created Devise Users table and Type table. I added the type_id column to the users table through migration.
Below are the links in home.html.erb:
<%= link_to 'Basic Sign up', new_user_registration_path(type: #basic_type), class: 'btn btn-success'%>
<%= link_to 'Pro Sign up', new_user_registration_path(type: #pro_type), class: 'button' %>
Below is the pages_controller.rb
class PagesController < ApplicationController
def home
#basic_type = Type.find(1)
#pro_type = Type.find(2)
end
def about
end
end
Below are the models:
type.rb
class Type < ActiveRecord::Base
has_many :users
end
user.rb
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable
belongs_to :type
end
This is my migration file of type:
class CreateTypes < ActiveRecord::Migration
def change
create_table :types do |t|
t.string :name
t.timestamps
end
end
end
This is the migration file adding types to user:
class AddTypeToUser < ActiveRecord::Migration
def change
add_column :users, :type_id, :integer
end
end
Users table in schema.rb:
create_table "users", force: :cascade do |t|
t.string "email", limit: 255, default: "", null: false
t.string "encrypted_password", limit: 255, default: "", null: false
t.string "reset_password_token", limit: 255
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", limit: 4, default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip", limit: 255
t.string "last_sign_in_ip", limit: 255
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "type_id", limit: 4
end
These are my registration forms:
_basic_form.html.erb:
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: {id: 'basic_type'}) do |f| %>
<%= devise_error_messages! %>
<%= hidden_field_tag 'type', params[:type] %>
<div class="field form-group">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true, class: 'form-control' %>
</div>
<div class="field form-group">
<%= f.label :password %>
<% if #validatable %>
<em>(<%= #minimum_password_length %> characters minimum)</em>
<% end %><br />
<%= f.password_field :password, autocomplete: "off", class: 'form-control' %>
</div>
<div class="field form-group">
<%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation, autocomplete: "off", class: 'form-control' %>
</div>
<div class="actions form-group">
<%= f.submit "Sign up", class: 'btn btn-success' %>
</div>
<% end %>
_pro_form.html.erb:
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
<%= devise_error_messages! %>
<%= hidden_field_tag 'type', params[:type] %>
<div class="field form-group">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true, class: 'form-control' %>
</div>
<div class="field form-group">
<%= f.label :password %>
<% if #validatable %>
<em>(<%= #minimum_password_length %> characters minimum)</em>
<% end %><br />
<%= f.password_field :password, autocomplete: "off", class: 'form-control' %>
</div>
<div class="field form-group">
<%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation, autocomplete: "off", class: 'form-control' %>
</div>
<div class="actions form-group">
<%= f.submit "Sign up", class: 'btn btn-success', id: 'form-submit-btn' %>
</div>
<% end %>
new.html.erb:
<div class="row">
<div class="col-md-6 col-md-offset-3 text-center">
<% if params[:type] == '2'%>
<h1>Pro Account</h1>
<p>Sign up for the pro account!</p>
<% else %>
<h1>Basic Account</h1>
<p>Sign up for free and get basic access to our community.</p>
<% end %>
</div>
<div class="col-md-6 col-md-offset-3">
<div class="well">
<h2>Sign up</h2>
<% if params[:type] == '2'%>
<%= render "pro_form"%>
<% else %>
<%= render "basic_form"%>
<% end %>
<div class="actions form-group btn btn-default">
<%= render "devise/shared/links" %>
</div>
</div>
</div>
</div>
When I am signing up as basic or as pro in URL it is showing:
http://localhost:3000/users/sign_up?type=1
OR
http://localhost:3000/users/sign_up?type=2
But in database in the type_id column it is showing as nil.

Validating then using virtual attributes to create a devise user

So I have two models, User and Employee. User has one employee and Employee belongs to User. I want to create an employee but first I have to create a new User. My Employee model does not have the attributes :email, :password, :password_confirmation so I created virtual attributes. This is the error that pops up Validation failed: Email is invalid, Password confirmation doesn't match Password
here is my employee model
class Employee < ApplicationRecord
belongs_to :user
attr_accessor :email, :password, :password_confirmation
validates :email, format: { with: /\A([^#\s]+)#((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, on: :create }
validates :password, confirmation: true
end
my employee controller
class EmployeesController < ApplicationController
def create
#newuser=User.create!(
email: :email,
password: :password,
password_confirmation: :password_confirmation
)
#employee = Employee.new(employee_params)
respond_to do |format|
if #employee.save
format.html { redirect_to #employee, notice: 'Employee was successfully created.' }
format.json { render :show, status: :created, location: #employee }
else
format.html { render :new }
format.json { render json: #employee.errors, status: :unprocessable_entity }
end
end
end
private
def employee_params
params.require(:employee).permit(:name, :contact_no, :role_id, #newuser.id)
end
end
And my form
<%= form_for(employee) do |f| %>
<% if employee.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(employee.errors.count, "error") %> prohibited this employee from being saved:</h2>
<ul>
<% employee.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :email %>
<%= f.email_field :email %>
</div>
<div class="field">
<%= f.password_field :password %>
<%= f.password_field :password_confirmation %>
</div>
<div class="field">
<%= f.label :name %>
<%= f.text_field :name %>
</div>
<div class="field">
<%= f.label :contact_no %>
<%= f.text_field :contact_no %>
</div>
<div class="field">
<%= f.label :role_id %>
<%= f.number_field :role_id %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
I'm still learning rails and would greatly appreciate your help
if you don't have attributes :email, :password, :password_confirmation then remove the following validation:
validates :email, format: { with: /\A([^#\s]+)#((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i, on: :create }
validates :password, confirmation: true
from Employee Model.
I have found the solution to my problem, it seems that my user parameters weren't following rails' strong parameters rule. so my controller has this now
def employee_params
params.require(:employee).permit(:name, :contact_no, :role_id)
end
def user_params
params.require(:employee).permit(:email, :password, :password_confirmation)
end
I was then able to make the user using the parameters without a problem.

Ruby on rails form data not not getting saved

So i am getting trouble in saving form data,.Any help will b appreciable
form is submitted without getting any error, but in database, nothing is stored
i am new on rails
users_controller
class UsersController < ApplicationController
def new
#user= User.new
end
def create
#user = User.new(params[:User])
if #user.save
flash[:notice]= "you signed up successfully"
flash[:color]= "valid"
else
flash[:notice]= "failed"
flash[:color]="invalid"
end
render "new"
end
end
new.html.erb
<% page_title="Signup" %>
<div class="Sign_Form">
<h1>Sign up</h1>
<%= form_for(:user, :url => {:controller => 'users', :action => 'create'}) do |f| %>
<p> Username:</br> <%= f.text_field :username %> </p>
<p> Email:</br> <%= f.text_field :email %> </p>
<p> Password:</br> <%= f.password_field :password %></p>
<p> Password Confirmation:</br> <%= f.password_field :password_confirmation %> </p>
<%= f.submit :Signup %>
<% end %>
<% if #user.errors.any? %>
<ul class="Signup_Errors">
<% for message_error in #user.errors.full_messages %>
<li>* <%= message_error %></li>
<% end %>
</ul>
<% end %>
</div>
in app/models/user.rb
class User < ActiveRecord::Base
attr_accessor :password
EMAIL_REGEX = /^[A-Z0-9._%+-]+#[A-Z0-9.-]+\.[A-Z]{2,4}$/i
validates :username, :presence => true, :uniqueness => true, :length => { :in => 3..20 }
validates :email, :presence => true, :uniqueness => true #:format => EMAIL_REGEX
validates :password, :presence =>true #:confirmation => true #password_confirmation attr
validates_length_of :password, :in => 6..20, :on => :create
end
In users_controller, create method, you are using
#user = User.new(params[:User])
replace it with following code, hope it will work fine.
#user = User.new(params[:user])
And,also use strong params if you are using rails 4. Like follwoing.
def create
#user = User.new(user_params)
if #user.save
flash[:notice]= "you signed up successfully"
flash[:color]= "valid"
else
flash[:notice]= "failed"
flash[:color]="invalid"
end
render "new"
end
private
def user_params
params.require(:user).permit(:username, :account, :email, :password, :password_confirmation)
end
If, it still not works, then, please display your log.
If you are using Rails 4 you need to use strong parameters to whitelist the parameters you want to assign to your models.
This became non-optional in Rails 4 to prevent mass-assignment vulnerabilities where a malicious user can assign any property to a model after Egor Homakovs much publicised Github attack.
Also note that Ruby is case sensitive. This applies to hash keys as well:
irb(main):003:0> hash = { a: 1 }
=> {:a=>1}
irb(main):004:0> hash[:A]
=> nil
Which is why why you do User.new(params[:User]) you are actually doing User.new(nil)
This is a corrected version of your controller
class UsersController < ApplicationController
def new
#user= User.new
end
def create
#user = User.new(params[:User])
if #user.save
flash[:notice]= "you signed up successfully"
flash[:color]= "valid"
# You should redirect instead of rendering the form again
redirect_to #user # or redirect_to root_path
else
flash[:notice]= "failed"
flash[:color]="invalid"
render "new" # Needs to be inside the "else" statement
# Otherwise you will get a double render error
end
end
def user_params
params.require(:user)
.allow(:username, :email, :password, :password_confirmation)
end
end
Added:
You can also simplify your form_for to
<%= form_for(:user) do |f| %>
Rails will by convention route the form to UserController#create.
Also you should use <label> tags for accessibility, as they help people who use assistive technology such as screen readers to find the correct inputs.
By using the built in label helper rails will set up the for attribute and you can translate the label texts with Rails built in I18n functionality.
<% page_title="Signup" %>
<div class="Sign_Form">
<h1>Sign up</h1>
<%= form_for(:user) do |f| %>
<div class="row">
<%= f.label :username %>:</br>
<%= f.text_field :username %>
</div>
<div class="row">
<%= f.label :email %>:</br>
<%= f.text_field :email %>
</div>
<div class="row">
<%= f.label :password %>:</br>
<%= f.password_field :password %>
</div>
<%= f.submit :Signup %>
<% end %>
<% if #user.errors.any? %>
<ul class="Signup_Errors">
<%# for loops are almost never used in ruby. %>
<%# .each is the idiomatically correct way %>
<% #user.errors.full_messages.each do |message_error| %>
<li>* <%= message_error %></li>
<% end %>
</ul>
<% end %>
</div>

How to use the same form for creating and editing in ruby on rails

I am new to ruby. I have the same form but i need it to perform creation/updation as and when required. The problem i have now is that whenever i call edit instead of editing the details of an existing user, i am getting a new user with the edited details. To put it simply, i think whenever i perform edit, the create method is being called.
So is there any way to use single form for both new and edit instead of using separate forms.
The following code is for editing user details:
<%= link_to 'Home', root_path %>
<h2>Edit user</h2>
<%= form_for :user, url: user_index_path do |f| %>
<p>
<%= f.label :name %><br>
<%= f.text_field :name %>
</p>
<p>
<%= f.label :address %><br>
<%= f.text_area :address %>
</p>
<p>
<%= f.label :email %><br>
<%= f.text_field :email %>
</p>
<p>
<%= f.label :phone %><br>
<%= f.text_field :phone %>
</p>
<p>
<%= f.label :state %><br>
<%= f.text_field :state %>
</p>
<p>
<%= f.label :country %>
<%= f.collection_select(:country, Country.all, :name, :name) %>
</p>
<p>
<%= f.submit %>
</p>
<% end %>
The following code is for creating user:
<%= link_to 'Home', root_path %>
<h2>Create new user</h2>
<%= form_for :user, url: user_index_path do |f| %>
<p>
<%= f.label :name %><br>
<%= f.text_field :name %>
</p>
<p>
<%= f.label :address %><br>
<%= f.text_area :address %>
</p>
<p>
<%= f.label :email %><br>
<%= f.text_field :email %>
</p>
<p>
<%= f.label :phone %><br>
<%= f.text_field :phone %>
</p>
<p>
<%= f.label :state %><br>
<%= f.text_field :state %>
</p>
<p>
<%= f.label :country %>
<%= f.collection_select(:country, Country.all, :name, :name) %>
</p>
<p>
<%= f.submit %>
</p>
<% end %>
And this is my controller:
class UserController < ApplicationController
def index
#users = User.all
end
def show
#user = User.find(params[:id])
end
def new
#user = User.new
end
def create
#user = User.new(user_params)
if #user.save
redirect_to #user
else
render 'new'
end
end
def edit
#user = User.find(params[:id])
end
def update
##user = User.find(params[:id])
if #user.update(user_params)
redirect_to #user
else
render 'edit'
end
end
def destroy
#user = User.find(params[:id])
#user.destroy
redirect_to user_index_path
end
private
def user_params
params.require(:user).permit(:name, :address, :email, :phone, :state, :country)
end
end
Since i am new to ruby, i did not get the exact details of how http requests function in ruby.
users/_form.html.erb
<%= link_to 'Home', root_path %>
<%= form_for #user do |f| %>
<p>
<%= f.label :name %><br>
<%= f.text_field :name %>
</p>
<p>
<%= f.label :address %><br>
<%= f.text_area :address %>
</p>
<p>
<%= f.label :email %><br>
<%= f.text_field :email %>
</p>
<p>
<%= f.label :phone %><br>
<%= f.text_field :phone %>
</p>
<p>
<%= f.label :state %><br>
<%= f.text_field :state %>
</p>
<p>
<%= f.label :country %>
<%= f.collection_select(:country, Country.all, :name, :name) %>
</p>
<p>
<%= f.submit %>
</p>
<% end %>
users/new.html.erb
<h2>Create new user</h2>
<%= render 'form' %>
users/edit.html.erb
<h2>Edit user</h2>
<%= render 'form' %>
users_controller.rb
class UsersController < ApplicationController
before_filter :find_user, only: [:show, :edit, :update, :destroy]
def index
#users = User.all
end
def show
end
def new
#user = User.new
end
def create
#user = User.new(user_params)
if #user.save
redirect_to #user
else
render 'new'
end
end
def edit
end
def update
if #user.update(user_params)
redirect_to #user
else
render 'edit'
end
end
def destroy
#user.destroy
redirect_to user_index_path
end
private
def user_params
params.require(:user).permit(:name, :address, :email, :phone, :state, :country)
end
def find_user
#user = User.find(params[:id])
end
end
When you have same view code for two or more methods, you should create a partial of same view code and render it in those methods. This is called DRY principle in ruby on rails

Many-to-Many Nested Attributes in Rails 4 (with strong parameters)

I have been trying to figure this one out for a few days now. I am using Rails 4 (with the updated mass assignment technique) and trying to use nested attributes with a many-to-many relationship. My record is saving to the DB but everything is nil and I'm getting an "Unpermitted parameters: school, alumnis, prospects" error in my logs.
Here's what I have:
referral.rb
class Referral < ActiveRecord::Base
belongs_to :school
belongs_to :alumni
belongs_to :prospect
end
alumni.rb
class Alumni < ActiveRecord::Base
has_many :referrals
has_many :prospects, through: :referrals
accepts_nested_attributes_for :referrals
end
school.rb
class School < ActiveRecord::Base
has_many :referrals
has_many :prospects, through: :referrals
has_many :alumnis, through: :referrals
accepts_nested_attributes_for :referrals
end
prospect.rb
class Prospect < ActiveRecord::Base
has_many :referrals
has_many :alumnis, through: :referrals
accepts_nested_attributes_for :referrals
end
referrals_controller.rb
def create
#referral = Referral.create(referral_params)
respond_to do |format|
if #referral.save
# ReferralMailer.referrer_email(#referral).deliver
# ReferralMailer.referral_email(#referral).deliver
format.html { redirect_to #referral, notice: 'Referral was successfully created.' }
format.json { render action: 'show', status: :created, location: #referral }
else
format.html { render action: 'new' }
format.json { render json: #referral.errors, status: :unprocessable_entity }
end
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_referral
#referral = Referral.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def referral_params
params.require(:referral).permit(prospects_attributes: [:first_name, :last_name, :email], alumnis_attributes: [:first_name, :last_name, :email], schools_attributes: [:name])
end
_form.html.erb
<%= form_for(#referral) do |f| %>
<% if #referral.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(#referral.errors.count, "error") %> prohibited this referral from being saved:</h2>
<ul>
<% #referral.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<%= f.fields_for :school do |builder| %>
<%= builder.label :name, "School Name" %>
<%= builder.text_field :name %>
<% end %>
<%= f.fields_for :alumnis do |builder| %>
<%= builder.label :first_name, "First Name" %>
<%= builder.text_field :first_name %>
<%= builder.label :last_name, "Last Name" %>
<%= builder.text_field :last_name %>
<%= builder.label :email, "Email" %>
<%= builder.text_field :email %>
<% end %>
<%= f.fields_for :prospects do |builder| %>
<%= builder.label :first_name, "First Name" %>
<%= builder.text_field :first_name %>
<%= builder.label :last_name, "Last Name" %>
<%= builder.text_field :last_name %>
<%= builder.label :email, "Email" %>
<%= builder.text_field :email %>
<% end %>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
server log output
Processing by ReferralsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"Ee+rREUU/0wGzNFTEaMxr8oRStaA53X9fmDrlVRyrD8=", "referral"=>{"school"=>{"name"=>"asdf"}, "alumnis"=>{"first_name"=>"asdf", "last_name"=>"asfd", "email"=>"asdf"}, "prospects"=>{"first_name"=>"asdf", "last_name"=>"asdf", "email"=>"asdf"}}, "commit"=>"Create Referral"}
Unpermitted parameters: school, alumnis, prospects
(0.1ms) begin transaction
SQL (0.5ms) INSERT INTO "referrals" ("created_at", "updated_at") VALUES (?, ?) [["created_at", Fri, 12 Jul 2013 03:49:06 UTC +00:00], ["updated_at", Fri, 12 Jul 2013 03:49:06 UTC +00:00]]
(0.6ms) commit transaction
(0.1ms) begin transaction
(0.1ms) commit transaction
Redirected to http://localhost:3000/referrals/68
Referral Record
=> #<Referral id: 68, created_at: "2013-07-12 03:49:06", updated_at: "2013-07-12 03:49:06", school_id: nil, alumni_id: nil, prospect_id: nil>
You should pass also 'id' in each of your nested model params try :
def referral_params
params.require(:referral).permit(prospects_attributes: [:id,:first_name, :last_name, :email], alumnis_attributes: [:id,:first_name, :last_name, :email], schools_attributes: [:id,:name])
end
Have swing
Cheers
You parameters are not being past to the controller as strong parameters is expecting.
From you server log:
"referral" => {
"school" => {
"name" => "asdf" },
"alumnis" => {
"first_name" => "asdf",
"last_name" => "asfd",
"email" => "asdf"
},
"prospects" => {
"first_name" => "asdf",
"last_name" => "asdf",
"email" => "asdf"
}
}
Strong parameters is expecting prospects_attributes, alumnis_attributes and schools_attributes so prospects, alumnis and school are getting blocked and the objects are getting created without any attributes.