ruby on rails - Devise Admin works locally but not on Heroku -
i'm creating app using ruby on rails , devise. i've created user model , admin model , have app working fine when run locally when run on heroku i'm having problems. trouble when try create new admin i'm shown error message says "we're sorry, went wrong." i've done rake db:migrate , heroku run rake db:migrate. when check heroku logs see this:
2013-04-08t19:34:49+00:00 app[web.1]: started "/admins/sign_up" 98.154.183.5 @ 2013-04-08 19:34:49 +0000 2013-04-08t19:34:49+00:00 app[web.1]: processing admins::registrationscontroller#new html 2013-04-08t19:34:50+00:00 app[web.1]: rendered devise/registrations/new.html.erb within layouts/application (431.3ms) 2013-04-08t19:34:50+00:00 app[web.1]: actionview::template::error (undefined method `name' #<admin:0x00000005207678>): 2013-04-08t19:34:50+00:00 app[web.1]: completed 500 internal server error in 549ms 2013-04-08t19:34:50+00:00 app[web.1]: 2013-04-08t19:34:50+00:00 app[web.1]: 3: <%= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { class: 'form-horizontal'}) |f| %> 2013-04-08t19:34:50+00:00 app[web.1]: 4: <%= f.error_notification %> 2013-04-08t19:34:50+00:00 app[web.1]: 5: 2013-04-08t19:34:50+00:00 app[web.1]: 6: <%= f.input :name %> 2013-04-08t19:34:50+00:00 app[web.1]: 8: <%= f.input :password %> 2013-04-08t19:34:50+00:00 app[web.1]: app/views/devise/registrations/new.html.erb:6:in `block in _app_views_devise_registrations_new_html_erb___3397140481100313441_30072880' 2013-04-08t19:34:50+00:00 app[web.1]: app/views/devise/registrations/new.html.erb:3:in `_app_views_devise_registrations_new_html_erb___3397140481100313441_30072880' 2013-04-08t19:34:50+00:00 app[web.1]: 7: <%= f.input :email %> 2013-04-08t19:34:50+00:00 app[web.1]: 9: <%= f.input :password_confirmation %> 2013-04-08t19:34:50+00:00 app[web.1]: 2013-04-08t19:34:50+00:00 app[web.1]: 2013-04-08t19:34:50+00:00 heroku[router]: at=info method=get path=/admins/sign_up host=protected-cliffs-2228.herokuapp.com fwd="98.154.183.5" dyno=web.1 connect=1ms service=559ms status=500 bytes=643
for reason unknown me heroku not linking admins/registrations/new.html.erb instead it's linking devise/registrations/new.html.erb it's reading 'name' attribute showing undefined method error.
my controllers/admins/registrations_controller.rb file looks this:
class admins::registrationscontroller < devise::registrationscontroller end
my routes.rb file looks this:
myfirstapp::application.routes.draw "users/show" devise_for :admins, :controllers => { :registrations => "admins/registrations", :sessions => "admins/sessions" } "/admins/sign_up" => "admins/registrations#new" "/admins/sign_in" => "admins/sessions#new" end resources :posts devise_for :users match 'users/:id' => 'users#show' root :to => 'pages#home' 'about' => 'pages#about' end
my development.rb file
myfirstapp::application.configure # settings specified here take precedence on in config/application.rb # in development environment application's code reloaded on # every request. slows down response time perfect development # since don't have restart web server when make code changes. config.cache_classes = false # log error messages when accidentally call methods on nil. config.whiny_nils = true # show full error reports , disable caching config.consider_all_requests_local = true config.action_controller.perform_caching = false # don't care if mailer can't send config.action_mailer.raise_delivery_errors = false # print deprecation notices rails logger config.active_support.deprecation = :log # use best-standards-support built browsers config.action_dispatch.best_standards_support = :builtin # raise exception on mass assignment protection active record models config.active_record.mass_assignment_sanitizer = :strict # log query plan queries taking more (works # sqlite, mysql, , postgresql) config.active_record.auto_explain_threshold_in_seconds = 0.5 # not compress assets config.assets.compress = false # expands lines load assets config.assets.debug = true config.action_mailer.default_url_options = { :host => 'localhost:3000' } end
my production.rb file
myfirstapp::application.configure # settings specified here take precedence on in config/application.rb # code not reloaded between requests config.cache_classes = true # full error reports disabled , caching turned on config.consider_all_requests_local = false config.action_controller.perform_caching = true # disable rails's static asset server (apache or nginx this) config.serve_static_assets = false # compress javascripts , css config.assets.compress = true # don't fallback assets pipeline if precompiled asset missed config.assets.compile = false # generate digests assets urls config.assets.digest = true # defaults nil , saved in location specified config.assets.prefix # config.assets.manifest = your_path # specifies header server uses sending files # config.action_dispatch.x_sendfile_header = "x-sendfile" # apache # config.action_dispatch.x_sendfile_header = 'x-accel-redirect' # nginx # force access app on ssl, use strict-transport-security, , use secure cookies. # config.force_ssl = true # see in log (default :info) # config.log_level = :debug # prepend log lines following tags # config.log_tags = [ :subdomain, :uuid ] # use different logger distributed setups # config.logger = activesupport::taggedlogging.new(sysloglogger.new) # use different cache store in production # config.cache_store = :mem_cache_store # enable serving of images, stylesheets, , javascripts asset server # config.action_controller.asset_host = "http://assets.example.com" # precompile additional assets (application.js, application.css, , non-js/css added) # config.assets.precompile += %w( search.js ) # disable delivery errors, bad email addresses ignored # config.action_mailer.raise_delivery_errors = false # enable threaded mode # config.threadsafe! # enable locale fallbacks i18n (makes lookups locale fall # i18n.default_locale when translation can not found) config.i18n.fallbacks = true # send deprecation notices registered listeners config.active_support.deprecation = :notify # log query plan queries taking more (works # sqlite, mysql, , postgresql) # config.active_record.auto_explain_threshold_in_seconds = 0.5 #in production, :host should set actual host of application. config.action_mailer.default_url_options = { :host => 'myfirstapp.heroku.com' } #configuring amazon s3 paperclip file uploads config.paperclip_defaults = { :storage => :s3, :s3_credentials => { :bucket => env['aws_bucket'], :access_key_id => env['aws_access_key_id'], :secret_access_key => env['aws_secret_access_key'] } } end
my .gitignore file
# see http://help.github.com/ignore-files/ more ignoring files. # # if find ignoring temporary files generated text editor # or operating system, want add global ignore instead: # git config --global core.excludesfile ~/.gitignore_global # ignore bundler config /.bundle # ignore default sqlite database. /db/*.sqlite3 # ignore logfiles , tempfiles. /log/*.log /tmp doc/ *.swp *~ .project .ds_store .idea # ignore paperclip unloaded files /public/system
i'd appreciate can get! first time creating app apologize if question dumb i'm stuck , need help!
first check gitrepo make sure file, or related file, reason has been ignored.
and if isn't issue nuke heroku project , start over.
heroku has special way of not creating new repos/projects correctly. fail rate pretty small, might have rolled snake eyes.
if doesn't work post production.rb , development.rb.
Comments
Post a Comment