0

enter image description here

When I load localhost:3000/admin I keep getting this message in the Chrome dev tools, and my RailsAdmin is then broken without jQuery

I am getting an error in my console

'JQuery is not defined'
'$ is not defined'
'Rails admin is not defined'.

gem 'jquery-rails'

i have this gem, also i done bundle install

Default file present in \app\assets\javascripts\application.rb

//= require jquery2
//= require jquery_ujs
//= require turbolinks
//= require_tree .

Then i change file \app\assets\javascripts\rails_admin\rails_admin.rb

//= require 'jquery2'
//= require jquery_ujs
//= require turbolinks
//= require_tree .

even i also tried this things

//= require jquery2
//= require jquery_ujs
//= require turbolinks
//= require_tree .

then

//= require 'jquery2'
//= require jquery_ujs
//= require turbolinks
//= require_tree .

everything i tried, still getting error in my browser console

But, it's worked on mac it's working perfectly,windows getting troble to me

Community
  • 1
  • 1
sathish
  • 300
  • 3
  • 14

2 Answers2

0

I think your file called app\assets\javascripts\rails_admin\rails_admin.js instead of .rb You shouldn't to rewrite this file, just add to manifest additional dependencies. Because jquery is required by gem.

As you see rails_admin.js load tons of dependencies by his own. So if you rewrite this file you will brake some gem functionality.

nautgrad
  • 414
  • 2
  • 8
  • Thanks your help! but got error like this TypeError: **Object doesn't support this property or method** ' begin extract_result(@runtime.exec_runtime(filepath), filepath) ensure File.unlink(tmpfile) end ' – sathish Apr 27 '17 at 09:10
  • Well i can't help you in this way, try removving all your own dependencies and start from bear `rails_admin`. It should have jqeury by it self, and then start adding. By the way version conflict is possible if you require `jquery2`, when `jquery` already loaded, so be careful. – nautgrad Apr 27 '17 at 09:38
  • thank for your help nautgrad,i have created new rails_admin ,there is no dependencies and also getting same error,may be it's neither gem or version problem – sathish Apr 27 '17 at 10:12
  • I don't know what is wrong. I just created new rails app added `rails_admin` and started server. jQuery loaded. See [screenshot](https://snag.gy/p8k5vS.jpg). – nautgrad Apr 27 '17 at 10:44
  • When I load localhost:3000/admin I keep getting this message in the Chrome dev tools, and my RailsAdmin is then broken without jQuery ,so it's might be my problem ! @@ **which version are you using rails** my version is 5.0.2 – sathish Apr 27 '17 at 10:55
  • I have `4.2.7.1` because 5 rails is quite raw in my opinion. I didn't find any mentions that `rails_admin` supports rails 5. – nautgrad Apr 27 '17 at 12:08
0

Checkout this solution, this might work in most of the cases,

Rails on windows

Community
  • 1
  • 1
Vedprakash Singh
  • 522
  • 8
  • 22