etewiah / property_web_builder

Create a fully featured real estate website on Rails in minutes! ⛺
https://propertywebbuilder.com
MIT License
544 stars 257 forks source link

Problem when default configurations are changed #11

Closed cvillalba closed 7 years ago

cvillalba commented 7 years ago

Hi again Ed

I have finally deployed your app succesfully in my local environment and let me tell you that it's great.

So far I was going thought some configurations and I realized that when I changed the default currency, when I pressed "Go To Site" I got a missing template error, where the log file shows this:

Started PUT "/api/v1/website" for ::1 at 2017-04-14 18:11:16 -0400
  Pwb::User Load (0.4ms)  SELECT  "pwb_users".* FROM "pwb_users" WHERE "pwb_users"."id" = $1 ORDER BY "pwb_users"."id" ASC LIMIT $2  [["id", 1], ["LIMIT", 1]]
Processing by Pwb::Api::V1::WebsiteController#update as JSON
  Parameters: {"website"=>{"company_display_name"=>"Example Real Estate", "theme_name"=>"", "supported_locales"=>["en-US", "es-MX"], "default_client_locale"=>"en-US", "default_currency"=>"USD", "default_area_unit"=>"sqmt", "social_media"=>{"facebook"=>"https://www.facebook.com/propertywebbuilder", "linkedin"=>"https://www.linkedin.com/company/propertywebbuilder", "twitter"=>"https://twitter.com/prptywebbuilder"}, "style_variables"=>{"primary_color"=>"#e91b23", "secondary_color"=>"#3498db", "action_color"=>"green", "body_style"=>"siteLayout.wide", "theme"=>"light"}, "sl_without_variants"=>["en", "es"]}}
  Pwb::Agency Load (0.3ms)  SELECT  "pwb_agencies".* FROM "pwb_agencies" ORDER BY "pwb_agencies"."id" DESC LIMIT $1  [["LIMIT", 1]]
  Pwb::Website Load (0.2ms)  SELECT  "pwb_websites".* FROM "pwb_websites" WHERE "pwb_websites"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
Unpermitted parameters: company_display_name, default_client_locale, social_media, style_variables, sl_without_variants
   (0.1ms)  BEGIN
  SQL (0.3ms)  UPDATE "pwb_websites" SET "default_currency" = $1, "updated_at" = $2 WHERE "pwb_websites"."id" = $3  [["default_currency", "USD"], ["updated_at", 2017-04-14 22:11:16 UTC], ["id", 1]]
   (29.1ms)  COMMIT
   (0.2ms)  BEGIN
   (0.1ms)  COMMIT
Completed 200 OK in 36ms (Views: 0.5ms | ActiveRecord: 30.4ms)

Started GET "/" for ::1 at 2017-04-14 18:11:18 -0400
Processing by Pwb::WelcomeController#index as HTML
  Pwb::Content Load (0.2ms)  SELECT  "pwb_contents".* FROM "pwb_contents" WHERE "pwb_contents"."key" = $1 LIMIT $2  [["key", "footerInfo"], ["LIMIT", 1]]
  Pwb::Agency Load (0.1ms)  SELECT  "pwb_agencies".* FROM "pwb_agencies" WHERE "pwb_agencies"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
  Pwb::Website Load (0.1ms)  SELECT  "pwb_websites".* FROM "pwb_websites" WHERE "pwb_websites"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
  CACHE (0.0ms)  SELECT  "pwb_websites".* FROM "pwb_websites" WHERE "pwb_websites"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
  CACHE (0.0ms)  SELECT  "pwb_websites".* FROM "pwb_websites" WHERE "pwb_websites"."id" = $1 LIMIT $2  [["id", 1], ["LIMIT", 1]]
Completed 500 Internal Server Error in 7ms (ActiveRecord: 0.4ms)

ActionView::MissingTemplate (Missing template pwb/welcome/index with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :coffee, :jbuilder]}. Searched in:
  * "/home/cvillalba/Workspace/elresidente/app/themes/views"
  * "/home/cvillalba/.rvm/gems/ruby-2.4.0/bundler/gems/property_web_builder-f33eca0c91cf/app/themes/views"
  * "/home/cvillalba/Workspace/elresidente/app/views"
  * "/home/cvillalba/.rvm/gems/ruby-2.4.0/bundler/gems/property_web_builder-f33eca0c91cf/app/views"
  * "/home/cvillalba/.rvm/gems/ruby-2.4.0/gems/devise-4.2.1/app/views"
  * "/home/cvillalba/.rvm/gems/ruby-2.4.0/gems/paloma-5.0.0/app/views"
  * "/home/cvillalba/.rvm/gems/ruby-2.4.0/gems/paloma-5.0.0/app/views"
):

actionview (5.0.2) lib/action_view/path_set.rb:46:in `find'
actionview (5.0.2) lib/action_view/lookup_context.rb:122:in `find'
actionview (5.0.2) lib/action_view/renderer/abstract_renderer.rb:18:in `find_template'
actionview (5.0.2) lib/action_view/renderer/template_renderer.rb:40:in `determine_template'
actionview (5.0.2) lib/action_view/renderer/template_renderer.rb:8:in `render'
actionview (5.0.2) lib/action_view/renderer/renderer.rb:42:in `render_template'
actionview (5.0.2) lib/action_view/renderer/renderer.rb:23:in `render'
actionview (5.0.2) lib/action_view/rendering.rb:104:in `_render_template'
actionpack (5.0.2) lib/action_controller/metal/streaming.rb:217:in `_render_template'
actionview (5.0.2) lib/action_view/rendering.rb:83:in `render_to_body'
actionpack (5.0.2) lib/action_controller/metal/rendering.rb:52:in `render_to_body'
actionpack (5.0.2) lib/action_controller/metal/renderers.rb:142:in `render_to_body'
actionpack (5.0.2) lib/abstract_controller/rendering.rb:26:in `render'
actionpack (5.0.2) lib/action_controller/metal/rendering.rb:36:in `render'
actionpack (5.0.2) lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
activesupport (5.0.2) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
/home/cvillalba/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/benchmark.rb:308:in `realtime'
activesupport (5.0.2) lib/active_support/core_ext/benchmark.rb:12:in `ms'
actionpack (5.0.2) lib/action_controller/metal/instrumentation.rb:44:in `block in render'
actionpack (5.0.2) lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime'
activerecord (5.0.2) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
actionpack (5.0.2) lib/action_controller/metal/instrumentation.rb:43:in `render'
/home/cvillalba/.rvm/gems/ruby-2.4.0/bundler/gems/property_web_builder-f33eca0c91cf/app/controllers/pwb/welcome_controller.rb:14:in `index'
actionpack (5.0.2) lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
actionpack (5.0.2) lib/abstract_controller/base.rb:188:in `process_action'
actionpack (5.0.2) lib/action_controller/metal/rendering.rb:30:in `process_action'
actionpack (5.0.2) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (5.0.2) lib/active_support/callbacks.rb:126:in `call'
activesupport (5.0.2) lib/active_support/callbacks.rb:506:in `block (2 levels) in compile'
activesupport (5.0.2) lib/active_support/callbacks.rb:455:in `call'
activesupport (5.0.2) lib/active_support/callbacks.rb:101:in `__run_callbacks__'
activesupport (5.0.2) lib/active_support/callbacks.rb:750:in `_run_process_action_callbacks'
activesupport (5.0.2) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.2) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (5.0.2) lib/action_controller/metal/rescue.rb:20:in `process_action'
actionpack (5.0.2) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (5.0.2) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (5.0.2) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (5.0.2) lib/active_support/notifications.rb:164:in `instrument'
actionpack (5.0.2) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (5.0.2) lib/action_controller/metal/params_wrapper.rb:248:in `process_action'
activerecord (5.0.2) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (5.0.2) lib/abstract_controller/base.rb:126:in `process'
actionview (5.0.2) lib/action_view/rendering.rb:30:in `process'
actionpack (5.0.2) lib/action_controller/metal.rb:190:in `dispatch'
actionpack (5.0.2) lib/action_controller/metal.rb:262:in `dispatch'
actionpack (5.0.2) lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
actionpack (5.0.2) lib/action_dispatch/routing/route_set.rb:32:in `serve'
actionpack (5.0.2) lib/action_dispatch/journey/router.rb:39:in `block in serve'
actionpack (5.0.2) lib/action_dispatch/journey/router.rb:26:in `each'
actionpack (5.0.2) lib/action_dispatch/journey/router.rb:26:in `serve'
actionpack (5.0.2) lib/action_dispatch/routing/route_set.rb:725:in `call'
railties (5.0.2) lib/rails/engine.rb:522:in `call'
railties (5.0.2) lib/rails/railtie.rb:193:in `public_send'
railties (5.0.2) lib/rails/railtie.rb:193:in `method_missing'
actionpack (5.0.2) lib/action_dispatch/routing/mapper.rb:17:in `block in <class:Constraints>'
actionpack (5.0.2) lib/action_dispatch/routing/mapper.rb:46:in `serve'
actionpack (5.0.2) lib/action_dispatch/journey/router.rb:39:in `block in serve'
actionpack (5.0.2) lib/action_dispatch/journey/router.rb:26:in `each'
actionpack (5.0.2) lib/action_dispatch/journey/router.rb:26:in `serve'
actionpack (5.0.2) lib/action_dispatch/routing/route_set.rb:725: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.1) lib/rack/etag.rb:25:in `call'
rack (2.0.1) lib/rack/conditional_get.rb:25:in `call'
rack (2.0.1) lib/rack/head.rb:12:in `call'
rack (2.0.1) lib/rack/session/abstract/id.rb:222:in `context'
rack (2.0.1) lib/rack/session/abstract/id.rb:216:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/cookies.rb:613:in `call'
activerecord (5.0.2) lib/active_record/migration.rb:553:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
activesupport (5.0.2) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
activesupport (5.0.2) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
activesupport (5.0.2) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.2) lib/action_dispatch/middleware/callbacks.rb:36:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
web-console (3.5.0) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.5.0) lib/web_console/middleware.rb:28:in `block in call'
web-console (3.5.0) lib/web_console/middleware.rb:18:in `catch'
web-console (3.5.0) lib/web_console/middleware.rb:18:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.0.2) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.0.2) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.0.2) lib/active_support/tagged_logging.rb:69:in `block in tagged'
activesupport (5.0.2) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.0.2) lib/active_support/tagged_logging.rb:69:in `tagged'
railties (5.0.2) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.0) lib/sprockets/rails/quiet_assets.rb:13:in `call'
request_store (1.3.2) lib/request_store/middleware.rb:9:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/request_id.rb:24:in `call'
rack (2.0.1) lib/rack/method_override.rb:22:in `call'
rack (2.0.1) lib/rack/runtime.rb:22:in `call'
activesupport (5.0.2) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.2) lib/action_dispatch/middleware/static.rb:136:in `call'
rack (2.0.1) lib/rack/sendfile.rb:111:in `call'
railties (5.0.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'
  Rendering /home/cvillalba/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/missing_template.html.erb within rescues/layout
  Rendering /home/cvillalba/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_source.html.erb
  Rendered /home/cvillalba/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (3.9ms)
  Rendering /home/cvillalba/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
  Rendered /home/cvillalba/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (2.6ms)
  Rendering /home/cvillalba/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
  Rendered /home/cvillalba/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (0.7ms)
  Rendered /home/cvillalba/.rvm/gems/ruby-2.4.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/missing_template.html.erb within rescues/layout (20.4ms)

Please let me know if you can help me this issue. Thanks Cheers

etewiah commented 7 years ago

Hi @cvillalba, that is indeed a bug - thanks for pointing it out.

I will try to have a fix by Monday ( can't promise but will try ;)

In the meantime you can work around this by going to the console and running:

wb = Pwb::Website.unique_instance
wb.theme_name = "default"
wb.save!
etewiah commented 7 years ago

I've just pushed out a fix. You can update the version of the pwb gem you are using to the latest by running:

bundle update pwb

BTW, you can take a sneek preview of the themes functionality I'm working on at the moment by browsing to "/en/admin/website/themes/default" on your site.

Or on the demo site: https://propertywebbuilder.herokuapp.com/en/admin/website/themes/default

If you see a real estate website with a "look and feel" that you prefer just let me know and we can work together to make it available ;)

cvillalba commented 7 years ago

Problem solved updating gem.

Thank you very much @etewiah

etewiah commented 7 years ago

Great, glad to hear. Let me know how it goes with the German translations - will be nice to be able to add another supported language.