vhochstein / active_scaffold

Rails 4 Version of activescaffold supporting jquery
MIT License
156 stars 34 forks source link

date_picker_bridge.js being created at startup, causes crash in Heroku #96

Closed MikeBlyth closed 13 years ago

MikeBlyth commented 13 years ago

Trying to run my application in Heroku, I get this error

/usr/ruby1.8.7/lib/ruby/1.8/fileutils.rb:1263:in `initialize':
Permission denied - /disk1/home/slugs/.../mnt/public/javascripts/active_scaffold/default/date_picker_bridge.js (Errno::EACCES)

It appears that AS is trying to write date_picker_bridge.js. I have set

 "ACTIVE_SCAFFOLD_INSTALL_ASSETS = false" 

in config/environments/production.rb. I have verified on my local system, in production mode, that date_picker_bridge.js is re-created when the Rails server starts, unlike the other two script files in that folder. This may be due to line 11 in active_scaffold/bridges/date_picker,

FileUtils.cp(source, destination)

which perhaps should have if File.exist?(File.join(destination, 'date_picker_bridge.js')) as a condition, but I don't know the system well enough to say whether this is the place where the problem is originating.

vhochstein commented 13 years ago

Indeed you are right. I ve fixed this issue.

Thanks a lot for reporting.

MikeBlyth commented 13 years ago

Thanks. I think the gem still needs to be updated ... at least my "gem update" said there were not any changes (yet). --Mike

vhochstein commented 13 years ago

That s easy to fix.

pekeler commented 13 years ago

Using the latest plugin, this file is constantly changing the order of keys in the hashes

Index: public/javascripts/active_scaffold/default/date_picker_bridge.js

--- public/javascripts/active_scaffold/default/date_picker_bridge.js (revision 28815) +++ public/javascripts/active_scaffold/default/date_picker_bridge.js (working copy) @@ -1,10 +1,10 @@ jQuery(function($){ if (typeof($.datepicker) === 'object') {

vhochstein commented 13 years ago

And why is that an issue?

RobertLowe commented 13 years ago

volker (on 1.9.2) ...:

when going into rails c

the date picker bridge will delete date_picker_bridge.js

via:

    FileUtils.rm(File.join(destination, 'date_picker_bridge.js')) if File.exist?(File.join(destination, 'date_picker_bridge.js'))

even with an initializers/active_scaffold.rb set as:

   ActiveScaffold.js_framework = :jquery

restores when running rails s

:S

This fixes it:

Gemfile:

  gem 'active_scaffold_vho',             :git => 'git://github.com/vhochstein/active_scaffold.git', :require => false
  gem 'render_component_vho',            :git => 'git://github.com/vhochstein/render_component.git'
  gem 'recordselect_vho',                :git => 'git://github.com/vhochstein/recordselect.git'
  gem 'active_scaffold_batch_vho',       :git => 'git://github.com/vhochstein/active_scaffold_batch.git', :require => false
  gem 'active_scaffold_export_vho',      :git => 'git://github.com/RobertLowe/active_scaffold_export.git', :require => false # 1.9.2 fix for csv
  gem 'active_scaffold_config_list_vho', :git => 'git://github.com/vhochstein/active_scaffold_config_list.git', :require => false

initalizers/active_record.rb

  require 'active_scaffold_vho'
  require 'active_scaffold_batch_vho'
  require 'active_scaffold_export_vho' 
  require 'active_scaffold_config_list_vho'

  ActiveScaffold.js_framework = :jquery
vhochstein commented 13 years ago

Hope I ve understood you correctly.

You are basically facing the issue, that active_scaffold initializer will not be executed if running rails c ?

RobertLowe commented 13 years ago

Close, but it's a litte weirder than that