Correct a bug where we get all params in the nonprofit
This commit is contained in:
parent
5026af021d
commit
82dbe471bd
2 changed files with 4 additions and 3 deletions
|
@ -54,11 +54,12 @@ class Houdini::V1::Nonprofit < Houdini::V1::BaseAPI
|
||||||
|
|
||||||
end
|
end
|
||||||
post do
|
post do
|
||||||
|
declared_params = declared(params)
|
||||||
np = nil
|
np = nil
|
||||||
u = nil
|
u = nil
|
||||||
Qx.transaction do
|
Qx.transaction do
|
||||||
begin
|
begin
|
||||||
np = Nonprofit.new(OnboardAccounts.set_nonprofit_defaults(params[:nonprofit]))
|
np = Nonprofit.new(OnboardAccounts.set_nonprofit_defaults(declared_params[:nonprofit]))
|
||||||
|
|
||||||
begin
|
begin
|
||||||
np.save!
|
np.save!
|
||||||
|
@ -80,7 +81,7 @@ class Houdini::V1::Nonprofit < Houdini::V1::BaseAPI
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
u = User.new(params[:user])
|
u = User.new(declared_params[:user])
|
||||||
u.save!
|
u.save!
|
||||||
|
|
||||||
role = u.roles.build(host: np, name: 'nonprofit_admin')
|
role = u.roles.build(host: np, name: 'nonprofit_admin')
|
||||||
|
|
|
@ -130,7 +130,7 @@ describe Houdini::V1::Nonprofit, :type => :controller do
|
||||||
it "succeeds" do
|
it "succeeds" do
|
||||||
force_create(:nonprofit, slug: "n", state_code_slug: "wi", city_slug: "appleton")
|
force_create(:nonprofit, slug: "n", state_code_slug: "wi", city_slug: "appleton")
|
||||||
input = {
|
input = {
|
||||||
nonprofit: {name: "n", state_code: "WI", city: "appleton", zip_code: 54915, url: 'www.cs.c'},
|
nonprofit: {name: "n", state_code: "WI", city: "appleton", zip_code: 54915, url: 'www.cs.c', website: 'www.cs.c'},
|
||||||
user: {name: "Name", email: "em@em.com", password: "12345678", password_confirmation: "12345678"}
|
user: {name: "Name", email: "em@em.com", password: "12345678", password_confirmation: "12345678"}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue