-
-
Save tabishiqbal/6c3839e53b5c5d34f0cbcc98185bb326 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Started POST "/projects/72/proposals" for 127.0.0.1 at 2017-07-17 20:11:04 +0200 | |
Processing by ProposalsController#create as JSON | |
Parameters: {"proposal"=>{"id"=>nil, "project_id"=>72, "supplier_id"=>10, "version"=>6, "final"=>true, "accepted"=>false, "accepted_at"=>nil, "billing_phases"=>[50, 50], "current"=>true, "comment"=>nil, "request_change"=>false, "request_change_at"=>nil, "user_id"=>2, "sections_attributes"=>[{"id"=>nil, "title"=>"laskmdlsakmd", "body"=>"lkmasldkmalskdmsa"}, {"id"=>nil, "title"=>"lkmasdlaskmd", "body"=>"lkmasdlkmasldkmasdsa\nas\nd\nsad\nsa\ndsa"}], "cost_items_attributes"=>[], "milestones_attributes"=>[]}, "project_id"=>"72"} | |
User Load (0.9ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["id", 20], ["LIMIT", 1]] | |
Creating scope :open. Overwriting existing method Project.open. | |
Project Load (0.7ms) SELECT "projects".* FROM "projects" WHERE "projects"."id" = $1 LIMIT $2 [["id", 72], ["LIMIT", 1]] | |
(1.1ms) SELECT COUNT(*) FROM "proposals" WHERE "proposals"."project_id" = $1 [["project_id", 72]] | |
Unpermitted parameters: :id, :comment, :request_change, :request_change_at, :user_id | |
User Load (0.7ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] | |
(0.5ms) BEGIN | |
Business Load (2.4ms) SELECT "businesses".* FROM "businesses" WHERE "businesses"."id" = $1 LIMIT $2 [["id", 10], ["LIMIT", 1]] | |
CACHE User Load (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 2], ["LIMIT", 1]] | |
SQL (1.0ms) INSERT INTO "proposals" ("project_id", "supplier_id", "version", "final", "created_at", "updated_at", "billing_phases", "current", "user_id") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) RETURNING "id" [["project_id", 72], ["supplier_id", 10], ["version", 8], ["final", "t"], ["created_at", "2017-07-17 20:11:04.819364"], ["updated_at", "2017-07-17 20:11:04.819364"], ["billing_phases", "{50,50}"], ["current", "t"], ["user_id", 2]] | |
SQL (4.2ms) INSERT INTO "proposal_sections" ("proposal_id", "title", "body", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["proposal_id", 40], ["title", "laskmdlsakmd"], ["body", "lkmasldkmalskdmsa"], ["created_at", "2017-07-17 20:11:04.822087"], ["updated_at", "2017-07-17 20:11:04.822087"]] | |
SQL (1.2ms) INSERT INTO "proposal_sections" ("proposal_id", "title", "body", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["proposal_id", 40], ["title", "lkmasdlaskmd"], ["body", "lkmasdlkmasldkmasdsa\nas\nd\nsad\nsa\ndsa"], ["created_at", "2017-07-17 20:11:04.827661"], ["updated_at", "2017-07-17 20:11:04.827661"]] | |
(1.0ms) COMMIT | |
Business Load (1.5ms) SELECT "businesses".* FROM "businesses" WHERE "businesses"."id" = $1 LIMIT $2 [["id", 10], ["LIMIT", 1]] | |
User Load (0.8ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 20], ["LIMIT", 1]] | |
(0.6ms) BEGIN | |
(0.7ms) COMMIT | |
Project::Status Load (0.5ms) SELECT "project_statuses".* FROM "project_statuses" WHERE "project_statuses"."name" = $1 LIMIT $2 [["name", "Quote ready"], ["LIMIT", 1]] | |
SQL (1.4ms) UPDATE "proposals" SET "current" = 'f' WHERE "proposals"."project_id" = $1 AND ("proposals"."id" != $2) [["project_id", 72], ["id", 40]] | |
(1.1ms) SELECT COUNT(*) FROM "proposals" WHERE "proposals"."project_id" = $1 AND "proposals"."final" = $2 [["project_id", 72], ["final", "t"]] | |
(0.7ms) BEGIN | |
Project Load (3.8ms) SELECT "projects".* FROM "projects" WHERE "projects"."id" = $1 LIMIT $2 [["id", 72], ["LIMIT", 1]] | |
SQL (1.0ms) INSERT INTO "user_notifications" ("user_id", "message", "project_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["user_id", 20], ["message", "Insta Traffic SEO and Adwords People has updated their proposal. Check it out!"], ["project_id", 72], ["created_at", "2017-07-17 20:11:04.926961"], ["updated_at", "2017-07-17 20:11:04.926961"]] | |
(1.0ms) COMMIT | |
(0.7ms) BEGIN | |
Project Load (0.9ms) SELECT "projects".* FROM "projects" WHERE "projects"."id" = $1 LIMIT $2 [["id", 72], ["LIMIT", 1]] | |
SQL (1.0ms) INSERT INTO "business_notifications" ("business_id", "message", "project_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id" [["business_id", 10], ["message", "Your revised proposal has been submitted to the client for approval"], ["project_id", 72], ["created_at", "2017-07-17 20:11:04.954545"], ["updated_at", "2017-07-17 20:11:04.954545"]] | |
(1.4ms) COMMIT | |
Completed 500 Internal Server Error in 469ms (ActiveRecord: 71.7ms) | |
NoMethodError (undefined method `proposal_url' for #<ProposalsController:0x007ffcc12c3998> | |
Did you mean? proposal_params): | |
app/controllers/proposals_controller.rb:65:in `block (2 levels) in create' | |
app/controllers/proposals_controller.rb:62:in `create' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NoMethodError in ProposalsController#create | |
undefined method `proposal_url' for #<ProposalsController:0x007ffcc12c3998> | |
Did you mean? proposal_params | |
Extracted source (around line #279): | |
#277 else | |
#278 method, args = handle_model(record) | |
*279 target.send(method, *args) | |
#280 end | |
#281 end | |
#282 | |
Extracted source (around line #188): | |
#186 HelperMethodBuilder.url.handle_class_call self, options | |
#187 else | |
*188 HelperMethodBuilder.url.handle_model_call self, options | |
#189 end | |
#190 end | |
#191 | |
Extracted source (around line #167): | |
#165 # last +url_for+ calls. | |
#166 def url_for(options = nil) | |
*167 full_url_for(options) | |
#168 end | |
#169 | |
#170 def full_url_for(options = nil) # :nodoc: | |
Rails.root: /Users/stephenmaclennan/Public/code/Cherryserve | |
Application Trace | |
app/controllers/proposals_controller.rb:65:in `block (2 levels) in create' | |
app/controllers/proposals_controller.rb:62:in `create' | |
Framework Trace | |
actionpack (5.1.2) lib/action_dispatch/routing/polymorphic_routes.rb:279:in `handle_model_call' | |
actionpack (5.1.2) lib/action_dispatch/routing/url_for.rb:188:in `full_url_for' | |
actionpack (5.1.2) lib/action_dispatch/routing/url_for.rb:167:in `url_for' | |
actionpack (5.1.2) lib/action_controller/metal/rendering.rb:117:in `_process_options' | |
actionpack (5.1.2) lib/action_controller/metal/streaming.rb:200:in `_process_options' | |
actionview (5.1.2) lib/action_view/rendering.rb:82:in `render_to_body' | |
actionpack (5.1.2) lib/action_controller/metal/rendering.rb:52:in `render_to_body' | |
actionpack (5.1.2) lib/action_controller/metal/renderers.rb:141:in `render_to_body' | |
actionpack (5.1.2) lib/abstract_controller/rendering.rb:24:in `render' | |
actionpack (5.1.2) lib/action_controller/metal/rendering.rb:36:in `render' | |
actionpack (5.1.2) lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render' | |
activesupport (5.1.2) lib/active_support/core_ext/benchmark.rb:12:in `block in ms' | |
/Users/stephenmaclennan/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/benchmark.rb:308:in `realtime' | |
activesupport (5.1.2) lib/active_support/core_ext/benchmark.rb:12:in `ms' | |
actionpack (5.1.2) lib/action_controller/metal/instrumentation.rb:44:in `block in render' | |
actionpack (5.1.2) lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime' | |
activerecord (5.1.2) lib/active_record/railties/controller_runtime.rb:29:in `cleanup_view_runtime' | |
actionpack (5.1.2) lib/action_controller/metal/instrumentation.rb:43:in `render' | |
actionpack (5.1.2) lib/action_controller/metal/mime_responds.rb:201:in `respond_to' | |
actionpack (5.1.2) lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action' | |
actionpack (5.1.2) lib/abstract_controller/base.rb:186:in `process_action' | |
actionpack (5.1.2) lib/action_controller/metal/rendering.rb:30:in `process_action' | |
actionpack (5.1.2) lib/abstract_controller/callbacks.rb:20:in `block in process_action' | |
activesupport (5.1.2) lib/active_support/callbacks.rb:131:in `run_callbacks' | |
actionpack (5.1.2) lib/abstract_controller/callbacks.rb:19:in `process_action' | |
actionpack (5.1.2) lib/action_controller/metal/rescue.rb:20:in `process_action' | |
actionpack (5.1.2) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action' | |
activesupport (5.1.2) lib/active_support/notifications.rb:166:in `block in instrument' | |
activesupport (5.1.2) lib/active_support/notifications/instrumenter.rb:21:in `instrument' | |
activesupport (5.1.2) lib/active_support/notifications.rb:166:in `instrument' | |
actionpack (5.1.2) lib/action_controller/metal/instrumentation.rb:30:in `process_action' | |
actionpack (5.1.2) lib/action_controller/metal/params_wrapper.rb:252:in `process_action' | |
activerecord (5.1.2) lib/active_record/railties/controller_runtime.rb:22:in `process_action' | |
actionpack (5.1.2) lib/abstract_controller/base.rb:124:in `process' | |
actionview (5.1.2) lib/action_view/rendering.rb:30:in `process' | |
rack-mini-profiler (0.10.2) lib/mini_profiler/profiling_methods.rb:102:in `block in profile_method' | |
actionpack (5.1.2) lib/action_controller/metal.rb:189:in `dispatch' | |
actionpack (5.1.2) lib/action_controller/metal.rb:253:in `dispatch' | |
actionpack (5.1.2) lib/action_dispatch/routing/route_set.rb:49:in `dispatch' | |
actionpack (5.1.2) lib/action_dispatch/routing/route_set.rb:31:in `serve' | |
actionpack (5.1.2) lib/action_dispatch/journey/router.rb:46:in `block in serve' | |
actionpack (5.1.2) lib/action_dispatch/journey/router.rb:33:in `each' | |
actionpack (5.1.2) lib/action_dispatch/journey/router.rb:33:in `serve' | |
actionpack (5.1.2) lib/action_dispatch/routing/route_set.rb:832:in `call' | |
warden (1.2.7) lib/warden/manager.rb:36:in `block in call' | |
warden (1.2.7) lib/warden/manager.rb:35:in `catch' | |
warden (1.2.7) lib/warden/manager.rb:35:in `call' | |
rack (2.0.3) lib/rack/etag.rb:25:in `call' | |
rack (2.0.3) lib/rack/conditional_get.rb:38:in `call' | |
rack (2.0.3) lib/rack/head.rb:12:in `call' | |
rack (2.0.3) lib/rack/session/abstract/id.rb:232:in `context' | |
rack (2.0.3) lib/rack/session/abstract/id.rb:226:in `call' | |
actionpack (5.1.2) lib/action_dispatch/middleware/cookies.rb:613:in `call' | |
activerecord (5.1.2) lib/active_record/migration.rb:556:in `call' | |
actionpack (5.1.2) lib/action_dispatch/middleware/callbacks.rb:26:in `block in call' | |
activesupport (5.1.2) lib/active_support/callbacks.rb:97:in `run_callbacks' | |
actionpack (5.1.2) lib/action_dispatch/middleware/callbacks.rb:24:in `call' | |
actionpack (5.1.2) lib/action_dispatch/middleware/executor.rb:12:in `call' | |
actionpack (5.1.2) lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call' | |
web-console (3.5.1) lib/web_console/middleware.rb:135:in `call_app' | |
web-console (3.5.1) lib/web_console/middleware.rb:28:in `block in call' | |
web-console (3.5.1) lib/web_console/middleware.rb:18:in `catch' | |
web-console (3.5.1) lib/web_console/middleware.rb:18:in `call' | |
actionpack (5.1.2) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call' | |
railties (5.1.2) lib/rails/rack/logger.rb:36:in `call_app' | |
railties (5.1.2) lib/rails/rack/logger.rb:24:in `block in call' | |
activesupport (5.1.2) lib/active_support/tagged_logging.rb:69:in `block in tagged' | |
activesupport (5.1.2) lib/active_support/tagged_logging.rb:26:in `tagged' | |
activesupport (5.1.2) lib/active_support/tagged_logging.rb:69:in `tagged' | |
railties (5.1.2) lib/rails/rack/logger.rb:24:in `call' | |
sprockets-rails (3.2.0) lib/sprockets/rails/quiet_assets.rb:13:in `call' | |
actionpack (5.1.2) lib/action_dispatch/middleware/remote_ip.rb:79:in `call' | |
actionpack (5.1.2) lib/action_dispatch/middleware/request_id.rb:25:in `call' | |
rack (2.0.3) lib/rack/method_override.rb:22:in `call' | |
rack (2.0.3) lib/rack/runtime.rb:22:in `call' | |
activesupport (5.1.2) lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call' | |
actionpack (5.1.2) lib/action_dispatch/middleware/executor.rb:12:in `call' | |
actionpack (5.1.2) lib/action_dispatch/middleware/static.rb:125:in `call' | |
rack (2.0.3) lib/rack/sendfile.rb:111:in `call' | |
rack-mini-profiler (0.10.2) lib/mini_profiler/profiler.rb:282:in `call' | |
railties (5.1.2) lib/rails/engine.rb:522:in `call' | |
puma (3.8.2) lib/puma/configuration.rb:224:in `call' | |
puma (3.8.2) lib/puma/server.rb:600:in `handle_request' | |
puma (3.8.2) lib/puma/server.rb:435:in `process_client' | |
puma (3.8.2) lib/puma/server.rb:299:in `block in run' | |
puma (3.8.2) lib/puma/thread_pool.rb:120:in `block in spawn_thread' | |
Full Trace | |
actionpack (5.1.2) lib/action_dispatch/routing/polymorphic_routes.rb:279:in `handle_model_call' | |
actionpack (5.1.2) lib/action_dispatch/routing/url_for.rb:188:in `full_url_for' | |
actionpack (5.1.2) lib/action_dispatch/routing/url_for.rb:167:in `url_for' | |
actionpack (5.1.2) lib/action_controller/metal/rendering.rb:117:in `_process_options' | |
actionpack (5.1.2) lib/action_controller/metal/streaming.rb:200:in `_process_options' | |
actionview (5.1.2) lib/action_view/rendering.rb:82:in `render_to_body' | |
actionpack (5.1.2) lib/action_controller/metal/rendering.rb:52:in `render_to_body' | |
actionpack (5.1.2) lib/action_controller/metal/renderers.rb:141:in `render_to_body' | |
actionpack (5.1.2) lib/abstract_controller/rendering.rb:24:in `render' | |
actionpack (5.1.2) lib/action_controller/metal/rendering.rb:36:in `render' | |
actionpack (5.1.2) lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render' | |
activesupport (5.1.2) lib/active_support/core_ext/benchmark.rb:12:in `block in ms' | |
/Users/stephenmaclennan/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/benchmark.rb:308:in `realtime' | |
activesupport (5.1.2) lib/active_support/core_ext/benchmark.rb:12:in `ms' | |
actionpack (5.1.2) lib/action_controller/metal/instrumentation.rb:44:in `block in render' | |
actionpack (5.1.2) lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime' | |
activerecord (5.1.2) lib/active_record/railties/controller_runtime.rb:29:in `cleanup_view_runtime' | |
actionpack (5.1.2) lib/action_controller/metal/instrumentation.rb:43:in `render' | |
app/controllers/proposals_controller.rb:65:in `block (2 levels) in create' | |
actionpack (5.1.2) lib/action_controller/metal/mime_responds.rb:201:in `respond_to' | |
app/controllers/proposals_controller.rb:62:in `create' | |
actionpack (5.1.2) lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action' | |
actionpack (5.1.2) lib/abstract_controller/base.rb:186:in `process_action' | |
actionpack (5.1.2) lib/action_controller/metal/rendering.rb:30:in `process_action' | |
actionpack (5.1.2) lib/abstract_controller/callbacks.rb:20:in `block in process_action' | |
activesupport (5.1.2) lib/active_support/callbacks.rb:131:in `run_callbacks' | |
actionpack (5.1.2) lib/abstract_controller/callbacks.rb:19:in `process_action' | |
actionpack (5.1.2) lib/action_controller/metal/rescue.rb:20:in `process_action' | |
actionpack (5.1.2) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action' | |
activesupport (5.1.2) lib/active_support/notifications.rb:166:in `block in instrument' | |
activesupport (5.1.2) lib/active_support/notifications/instrumenter.rb:21:in `instrument' | |
activesupport (5.1.2) lib/active_support/notifications.rb:166:in `instrument' | |
actionpack (5.1.2) lib/action_controller/metal/instrumentation.rb:30:in `process_action' | |
actionpack (5.1.2) lib/action_controller/metal/params_wrapper.rb:252:in `process_action' | |
activerecord (5.1.2) lib/active_record/railties/controller_runtime.rb:22:in `process_action' | |
actionpack (5.1.2) lib/abstract_controller/base.rb:124:in `process' | |
actionview (5.1.2) lib/action_view/rendering.rb:30:in `process' | |
rack-mini-profiler (0.10.2) lib/mini_profiler/profiling_methods.rb:102:in `block in profile_method' | |
actionpack (5.1.2) lib/action_controller/metal.rb:189:in `dispatch' | |
actionpack (5.1.2) lib/action_controller/metal.rb:253:in `dispatch' | |
actionpack (5.1.2) lib/action_dispatch/routing/route_set.rb:49:in `dispatch' | |
actionpack (5.1.2) lib/action_dispatch/routing/route_set.rb:31:in `serve' | |
actionpack (5.1.2) lib/action_dispatch/journey/router.rb:46:in `block in serve' | |
actionpack (5.1.2) lib/action_dispatch/journey/router.rb:33:in `each' | |
actionpack (5.1.2) lib/action_dispatch/journey/router.rb:33:in `serve' | |
actionpack (5.1.2) lib/action_dispatch/routing/route_set.rb:832:in `call' | |
warden (1.2.7) lib/warden/manager.rb:36:in `block in call' | |
warden (1.2.7) lib/warden/manager.rb:35:in `catch' | |
warden (1.2.7) lib/warden/manager.rb:35:in `call' | |
rack (2.0.3) lib/rack/etag.rb:25:in `call' | |
rack (2.0.3) lib/rack/conditional_get.rb:38:in `call' | |
rack (2.0.3) lib/rack/head.rb:12:in `call' | |
rack (2.0.3) lib/rack/session/abstract/id.rb:232:in `context' | |
rack (2.0.3) lib/rack/session/abstract/id.rb:226:in `call' | |
actionpack (5.1.2) lib/action_dispatch/middleware/cookies.rb:613:in `call' | |
activerecord (5.1.2) lib/active_record/migration.rb:556:in `call' | |
actionpack (5.1.2) lib/action_dispatch/middleware/callbacks.rb:26:in `block in call' | |
activesupport (5.1.2) lib/active_support/callbacks.rb:97:in `run_callbacks' | |
actionpack (5.1.2) lib/action_dispatch/middleware/callbacks.rb:24:in `call' | |
actionpack (5.1.2) lib/action_dispatch/middleware/executor.rb:12:in `call' | |
actionpack (5.1.2) lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call' | |
web-console (3.5.1) lib/web_console/middleware.rb:135:in `call_app' | |
web-console (3.5.1) lib/web_console/middleware.rb:28:in `block in call' | |
web-console (3.5.1) lib/web_console/middleware.rb:18:in `catch' | |
web-console (3.5.1) lib/web_console/middleware.rb:18:in `call' | |
actionpack (5.1.2) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call' | |
railties (5.1.2) lib/rails/rack/logger.rb:36:in `call_app' | |
railties (5.1.2) lib/rails/rack/logger.rb:24:in `block in call' | |
activesupport (5.1.2) lib/active_support/tagged_logging.rb:69:in `block in tagged' | |
activesupport (5.1.2) lib/active_support/tagged_logging.rb:26:in `tagged' | |
activesupport (5.1.2) lib/active_support/tagged_logging.rb:69:in `tagged' | |
railties (5.1.2) lib/rails/rack/logger.rb:24:in `call' | |
sprockets-rails (3.2.0) lib/sprockets/rails/quiet_assets.rb:13:in `call' | |
actionpack (5.1.2) lib/action_dispatch/middleware/remote_ip.rb:79:in `call' | |
actionpack (5.1.2) lib/action_dispatch/middleware/request_id.rb:25:in `call' | |
rack (2.0.3) lib/rack/method_override.rb:22:in `call' | |
rack (2.0.3) lib/rack/runtime.rb:22:in `call' | |
activesupport (5.1.2) lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call' | |
actionpack (5.1.2) lib/action_dispatch/middleware/executor.rb:12:in `call' | |
actionpack (5.1.2) lib/action_dispatch/middleware/static.rb:125:in `call' | |
rack (2.0.3) lib/rack/sendfile.rb:111:in `call' | |
rack-mini-profiler (0.10.2) lib/mini_profiler/profiler.rb:282:in `call' | |
railties (5.1.2) lib/rails/engine.rb:522:in `call' | |
puma (3.8.2) lib/puma/configuration.rb:224:in `call' | |
puma (3.8.2) lib/puma/server.rb:600:in `handle_request' | |
puma (3.8.2) lib/puma/server.rb:435:in `process_client' | |
puma (3.8.2) lib/puma/server.rb:299:in `block in run' | |
puma (3.8.2) lib/puma/thread_pool.rb:120:in `block in spawn_thread' | |
Request parameters | |
{"proposal"=>{"id"=>nil, | |
"project_id"=>72, | |
"supplier_id"=>10, | |
"version"=>6, | |
"final"=>true, | |
"accepted"=>false, | |
"accepted_at"=>nil, | |
"billing_phases"=>[50, | |
50], | |
"current"=>true, | |
"comment"=>nil, | |
"request_change"=>false, | |
"request_change_at"=>nil, | |
"user_id"=>2, | |
"sections_attributes"=>[{"id"=>nil, | |
"title"=>"laskmdlsakmd", | |
"body"=>"lkmasldkmalskdmsa"}, | |
{"id"=>nil, | |
"title"=>"lkmasdlaskmd", | |
"body"=>"lkmasdlkmasldkmasdsa\nas\nd\nsad\nsa\ndsa"}], | |
"cost_items_attributes"=>[], | |
"milestones_attributes"=>[]}, | |
"project_id"=>"72"} | |
Session dump | |
_csrf_token: "MkC24mFX8q5jhIB7j+TYiqyx5b9mbsR2uDAkXz4HO6I=" | |
session_id: "9ff795f1c653c427bf218468d133aec7" | |
warden.user.user.key: [[20], "$2a$11$.XU8absdKdWZqKp6gsKVn."] | |
Env dump | |
GATEWAY_INTERFACE: "CGI/1.2" | |
HTTP_ACCEPT: "application/json, text/plain, */*" | |
HTTP_ACCEPT_ENCODING: "gzip, deflate, br" | |
HTTP_ACCEPT_LANGUAGE: "en-US,en;q=0.8" | |
HTTP_ORIGIN: "http://localhost:3000" | |
HTTP_VERSION: "HTTP/1.1" | |
HTTP_X_CSRF_TOKEN: "bzM1H+FKVxX2xXePdDeq3YZ0hf/rAns4TF3GawVMQI9dc4P9gB2lu5VB9/T703JXKsVgQI1sv070beI0O0t7LQ==" | |
ORIGINAL_SCRIPT_NAME: "" | |
REMOTE_ADDR: "127.0.0.1" | |
SERVER_NAME: "localhost" | |
SERVER_PROTOCOL: "HTTP/1.1" | |
Response headers | |
None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create | |
@proposal = @project.proposals.create(proposal_params) | |
authorize @proposal | |
respond_to do |format| | |
if @proposal.save! | |
format.html { redirect_to project_proposal_path(@proposal.project, @proposal), notice: "Proposal successfully created and submitted to the client" } | |
format.json { render :show, status: :created, location: @proposal } | |
@project.update_attribute(:status_id, set_quote_ready) | |
# As there is a new final, all previous versions are no longer current | |
@project.proposals.where.not(id: @proposal.id).update_all(current: false) | |
# Set this new final version as the current version | |
if @project.proposals.all_final.count > 1 | |
@user.notify_user("#{@project.supplier.display_name} has updated their proposal. Check it out!", @project.id) | |
@project.supplier.notify_business("Your revised proposal has been submitted to the client for approval", @project.id) | |
else | |
@user.notify_user("#{@project.supplier.display_name} has submitted a proposal for your project. Accept it to start the project", @project.id) | |
@project.supplier.notify_business("Your proposal has been submitted to the client for approval", @project.id) | |
end | |
#UserMailer.new_proposal(@project.user).deliver_now | |
else | |
format.html { render :new, notice: "Proposal could not be saved" } | |
format.json { render json: @proposal.errors, status: :unprocessable_entity } | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= content_tag :div, | |
id: "proposal-form", | |
data: { | |
project: @project.to_json(include: [:industry, :addons, :features, :budget, :type]), | |
proposal: @proposal.to_json(except: [:created_at, :updated_at]), | |
sections_attributes: @proposal.sections.to_json(except: [:proposal_id, :created_at, :updated_at]), | |
cost_items_attributes: @proposal.cost_items.to_json(except: [:proposal_id, :created_at, :updated_at]), | |
milestones_attributes: @proposal.milestones.to_json(except: [:proposal_id, :created_at, :updated_at], include: (:dependencies)), | |
feedback: @feedback.to_json | |
} do %> | |
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var project = JSON.parse(element.dataset.project) | |
var proposal = JSON.parse(element.dataset.proposal) | |
var sectionsAttributes = JSON.parse(element.dataset.sectionsAttributes) | |
var costItemsAttributes = JSON.parse(element.dataset.costItemsAttributes) | |
var milestonesAttributes = JSON.parse(element.dataset.milestonesAttributes) | |
var feedback = JSON.parse(element.dataset.feedback) | |
proposal.sections_attributes = sectionsAttributes | |
proposal.cost_items_attributes = costItemsAttributes | |
proposal.milestones_attributes = milestonesAttributes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def proposal_params | |
params | |
.require(:proposal) | |
.permit( | |
:project_id, | |
:supplier_id, | |
:version, | |
:final, | |
:accepted, | |
:accepted_at, | |
:current, | |
billing_phases: [], | |
sections_attributes: [ | |
:id, | |
:title, | |
:body | |
], | |
cost_items_attributes: [ | |
:id, | |
:name, | |
:category, | |
:timing, | |
:price, | |
:quantity, | |
:taxable, | |
:tax, | |
:gross, | |
:net | |
], | |
milestones_attributes: [ | |
:id, | |
:name, | |
:due_date, | |
:done, | |
dependencies_attributes: [ | |
:id, | |
:name, | |
:due_date, | |
:done | |
] | |
] | |
) | |
.merge( | |
project_id: @project.id, | |
supplier_id: @project.supplier_id, | |
user_id: @project.user.id, | |
version: @version, | |
current: true | |
) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
saveProposal: function(final) { | |
this.$validator.validateAll() | |
if (!this.errors.any()) { | |
this.saving = true | |
if (final == true ) { | |
this.proposal.final = true | |
} else { | |
this.proposal.final = false | |
} | |
for (var i = 0; i < proposal.milestones_attributes.length; i ++) { | |
var ms = proposal.milestones_attributes[i] | |
ms.dependencies_attributes = ms.dependencies | |
console.log(ms) | |
} | |
this.$http.post('/projects/' + this.proposal.project_id + '/proposals', { | |
proposal: proposal | |
}) | |
.then(function (response) { | |
console.log('Saved successfully') | |
Turbolinks.visit('/projects/' + this.project.id + '/proposals/${response.body.id}') | |
}) | |
.catch(error => { | |
console.log('Error saving proposal. Please correct the errors') | |
this.saving = false | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment