Gailu
Gailu

Reputation: 111

Ruby on Rails Tutorial Delete user does not work on heroku

I am following Ruby on Rails Tutorial (3.2) by Michael Hartl. In chapter 9 delete user by admin user functionality is introduced. This is working fine on my local machine but not on heroku. Though the generated HTML is same both locally and on heroku

<a href="/users/2" data-confirm="You sure?" data-method="delete" rel="nofollow">delete</a>

When I click delete link locally I get popup with you sure? and on clicking OK it deletes the user. However with same code on heroku when I click delete link, it takes me to user page of that user instead of pop up with you sure? message.

Can someone please guide?

My application.js had following entries

//= require jquery_ujs
//= require bootstrap
//= require jquery
//= require_tree .

I tried to change the order as below with no success

//= require bootstrap
//= require jquery
//= require jquery_ujs
//= require_tree .

Upvotes: 1

Views: 1132

Answers (3)

Edson Momm
Edson Momm

Reputation: 160

I've made all this steps to clear/precompile the source and many others, none of them worked for me.

To resume, what I nedded to do was change the "Compress JavaScripts and CSS." on the file "config/environments/production.rd" that was using uglifier to use sass.

config.assets.css_compressor = :sass

Tip: Changing the local server to run as "production", helps to reproduce the problem localy.

rails server -e production

Upvotes: 0

Gailu
Gailu

Reputation: 111

I had done assets:precompile already so that was not the issue. However I have found the solution (rather a workaround)

Unfortunately same application.js does not work on both my local setup and on heroku. Following order works on heroku

//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require_tree .

Where as following order works on my local setup otherwise I run in to issue described in thread twitter bootstrap drop down suddenly not working

//= require jquery_ujs
//= require bootstrap
//= require jquery
//= require_tree .

Upvotes: 4

ph3nx
ph3nx

Reputation: 1036

Try to precompile the static assets. In your local console type:

rake assets:precompile

Then push the changes up to heroku

$ git add .
$ git commit -m "Add precompiled assets for Heroku"
$ git push heroku master

Upvotes: 4

Related Questions