Wednesday, 15 February 2012

ruby on rails - Form Pages are working locally but not on Heroku? -



ruby on rails - Form Pages are working locally but not on Heroku? -

my rails application has 2 stage registration, utilize devise gem. seems working fine on local server, on heroku (using postgres database), completing first form redirects error page (heroku's charming "something went wrong") rather sec form. couldn't find cause within heroku's logs.

here first form page:

<h3>create profile</h3> <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) |f| %> <%= render 'shared/error_messages'%> <div class="form-group"> <%= f.text_field :name, class: 'form-control', autofocus: true, placeholder: 'name shown providers' %> </div> <div class= "form-group"> <%= f.text_field :email, class: 'form-control', autofocus: true, placeholder: 'email'%> </div> <div class="form-group"> <%= f.password_field :password, class: 'form-control', autofocus: true, placeholder: 'password'%> </div> <div class="form-group"> <%= f.password_field :password_confirmation, class: 'form-control', autofocus: true, placeholder: 'confirm password'%> </div> <%= f.submit "submit", class: "btn btn-large btn-primary" %> <% end %>

and here second:

<h3>populate profile</h3> <div id="popform"> <div class="row"> <aside class="span4"> <section> <img src=<%= @user.avatar.url(:small) %> id="prof" class= "img-circle"/> <h1> <%= @user.name %> </h1> </section> </aside> </div> <div id='usereditform'> <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) |f| %> <div class="form-group"> <%= f.label :avatar%> <%= f.file_field :avatar%> </div> <div class="form-group"> <%= f.label :industry%> <%= f.select :industry, [['please select industry',nil],'professional services','graphic design','marketing','web development'], class: 'form-control'%> </div> <div class= "form-group"> <%= f.text_field :city, class: 'form-control', autofocus: true, placeholder: 'city'%> </div> <div class="form-group"> <%= f.label :state%> <%= f.select :state, options_for_select(us_states, "ca"), class: 'form-control'%> </div> <div class="form-group"> <%= f.text_field :website, class: 'form-control', autofocus: true, placeholder: 'website (if applicable)'%> </div> <div class= "form-group"> <%= f.text_field :description, class: 'form-control', id: 'dfield', autofocus:true,placeholder: 'description' %> </div> <div class= "form-group"> <%= f.submit "submit", class: "btn btn-large btn-primary" %> </div> </div> <% end%>

here overrode devise registrations controller:

class registrationscontroller < devise::registrationscontroller protected def after_sign_up_path_for(resource) if resource.is_a?(user) edit_user_registration_path else super end end def after_inactive_sign_up_path_for(resource) if resource.is_a?(user) edit_user_registration_path else super end end end

as requested, here config/routes.rb:

rails.application.routes.draw devise_for :providers devise_for :users, :controllers => {:registrations => "registrations"} resources :users resources :providers root :to=>'pages#home' match '/home', to: 'pages#home', via: 'get' end

and finally, here lastly several lines of heroku logs:

2014-06-21t21:32:44.872651+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/activerecord 4.1.1/lib/active_record/query_cache.rb:36:in `call' 2014-06-21t21:32:44.872662+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.1/lib/action_dispatch/middleware/remote_ip.rb:76:in `call' 2014-06-21t21:32:44.872664+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.1/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call' 2014-06-21t21:32:44.872665+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.1/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' 2014-06-21t21:32:44.872644+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.1/lib/action_dispatch/middleware/params_parser.rb:27:in `call' 2014-06-21t21:32:44.872650+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.1/lib/action_dispatch/middleware/cookies.rb:560:in `call' 2014-06-21t21:32:44.872673+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/rack/logger.rb:20:in `call' 2014-06-21t21:32:44.872675+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.1/lib/action_dispatch/middleware/request_id.rb:21:in `call' 2014-06-21t21:32:44.872676+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call' 2014-06-21t21:32:44.872682+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call' 2014-06-21t21:32:44.872666+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/railties-4.1.1/lib/rails/rack/logger.rb:38:in `call_app' 2014-06-21t21:32:44.872654+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.1/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call' 2014-06-21t21:32:44.872672+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.1/lib/active_support/tagged_logging.rb:68:in `tagged' 2014-06-21t21:32:44.872594+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.1/lib/action_controller/metal/params_wrapper.rb:250:in `process_action' 2014-06-21t21:32:44.872592+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.1/lib/action_controller/metal/instrumentation.rb:30:in `process_action' 2014-06-21t21:32:44.872585+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.1/lib/action_controller/metal/instrumentation.rb:31:in `block in process_action' 2014-06-21t21:32:44.872603+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.1/lib/action_controller/metal.rb:231:in `block in action' 2014-06-21t21:32:44.872597+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.1/lib/abstract_controller/base.rb:136:in `process' 2014-06-21t21:32:44.872605+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.1/lib/action_dispatch/routing/route_set.rb:80:in `dispatch' 2014-06-21t21:32:44.872678+00:00 app[web.1]: vendor/bundle/ruby/2.1.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'

are sure you've correctly configured database? error log seems indicate lastly thing trying access db, insert info user table. failure of type in production wouldn't lead failed transaction cause entire app crash.

ruby-on-rails heroku devise

No comments:

Post a Comment