Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error "different prefix:" with Active_Admin gem

to install active_admin - I updated my gems, did

rails generate active_admin:install
rake db:migrate

and then I want to go localhost:3000/admin

and I get this error page

ArgumentError in Active_admin/devise/sessions#new

Showing D:/Ruby192/lib/ruby/gems/1.9.1/gems/activeadmin-0.3.2/app/views/layouts/active_admin_logged_out.html.erb where line #9 raised:

different prefix: "D:/" and "C:/project/app/assets/stylesheets"
  (in C:/project/app/assets/stylesheets/active_admin.css.scss)
Extracted source (around line #9):

6:   <title><%= [@page_title, active_admin_application.site_title].compact.join(" | ") %></title>
7: 
8:   <% ActiveAdmin.application.stylesheets.each do |path| %>
9:     <%= stylesheet_link_tag path %>
10:   <% end %>
11:   <% ActiveAdmin.application.javascripts.each do |path| %>
12:     <%= javascript_include_tag path %>
Rails.root: C:/project

Application Trace | Framework Trace | Full Trace
Request

Parameters:

None
Show session dump

Show env dump

Response

Headers:

None

Note that the project folder and ruby folder are indeed in different drives (never thought it matters)

Update:

I have found this http://github.com/rails/rails/issues/660 which seems to be the same error with a solution, yet I don't understand what needs to be done for the error to go away.

Please help :)

like image 863
Nick Ginanto Avatar asked Oct 12 '11 12:10

Nick Ginanto


3 Answers

I use Window XP sp3 to work with Rails

  • The path of my Ruby Installer is C:\Ruby193
  • The path of my project is D:\rails_projects\myApp

The solution:

Get "Junction.exe", in Windows Vista used to "mklink"

  • Download junction.exe
  • Copy Junction.exe to C:\Windows\System32\

Create simbolic link

  • Write into your console "C:\> junction C:\myApp D:\rails_projects\myApp "

Run the myApp

  • C:\> cd myApp
  • C:\myApp> rails server
  • Go to http://localhost:3000/admin

It's Ok..!!!!

like image 163
Joseph Ramos Avatar answered Oct 22 '22 14:10

Joseph Ramos


The easiest way (for me at least) to work around this issue is to bundle your project gems into the project folder itself. From inside your project folder:

bundle install --path .bundle

This installs your project's requested gems into the .bundle folder inside the project. Subsequent calls to bundle exec will remember to use this cache of gems and should mitigate against the error above.

like image 39
Hasan Avatar answered Oct 22 '22 15:10

Hasan


Just move /assets/stylesheets/* to your project /lib/assets/stylesheets.

No need to rename any file or dependency as this path comes before any gem path.

You can check your assets paths stack by launching a rails console : rails c and executing the following : y Rails.application.config.assets.paths.

like image 26
ngryman Avatar answered Oct 22 '22 14:10

ngryman