Today I would like to give you a short guide about how you may get ActiveScaffold up and running with Rails 3.1. Please be aware that ActiveScaffold is nt fully ported to Rails 3.1, so this guide is for early adopters who wanna try it out or help finishing development work.
I assume that you ve got Rails 3.1/3.2 already installed on your computer.
1. rails new as_rails31
2. please add below the line gem ‘jquery_rails’ in your gem file following code:
Official Gems:
gem 'render_component_vho' gem 'active_scaffold_vho'
Github Gems:
gem 'render_component_vho', :git => 'git://github.com/vhochstein/render_component.git' gem 'active_scaffold_vho', :git => 'git://github.com/vhochstein/active_scaffold.git'
3. bundle install
4. bundle exec rake db:create
5. rails g active_scaffold Team name:string position:integer
6. bundle exec rake db:migrate
7. Edit file /app/assets/javascripts/application.js
//= require jquery //= require jquery-ui //= require jquery_ujs //= require active_scaffold //= require_tree .
8. Edit file /app/assets/stylesheets/application.css
*= require active_scaffold *= require_self *= require_tree .
Hope you will enjoy.
Jul 25, 2011 @ 00:39:21
Hi Volker
I think that there is a typo in the first line:
jquery_rails.git should be jquery-rails.git
When I run “bundler update” I get the following message:
Bundler could not find compatible versions for gem “rails”:
In Gemfile:
active_scaffold_vho depends on
rails (~> 3.1.0)
rails (3.1.0.rc4)
Any suggestions ?
Thanks
Regards, Tony
Jul 25, 2011 @ 08:01:02
Thanks a lot for reporting the type.
bundler update works for me… Which os do you use? Which bundler version do you use?
Jul 25, 2011 @ 09:18:56
Hi Volker
I am using Ubuntu 11.04.
My bundler version is 1.0.15
After I posted I did manage to get it working by “cheating”.
I forked your 3 “vho” gems and changed the rails dependencies to “3.0″.
bundle install then worked fine.
I am sure that there is a more elegant way to get it working but I am a bit of a Rails 3.0 / 3.1 noob.
I will now try experimenting
Regards, Tony
Aug 26, 2011 @ 07:56:35
Hi, what should I do? (newbie)
Bundler could not find compatible versions for gem “rails”:
In Gemfile:
active_scaffold_vho depends on
rails (~> 3.1.0)
rails (3.1.0.rc6)
Aug 29, 2011 @ 13:24:19
Several people already complaint about this. I m not sure how to fix this though, cause works on my system without any issue.
Aug 29, 2011 @ 19:52:24
I had the same problem. Is it possible to make the rails dependency:
rails (>= 3.1.0.rc1)
in the gem?
Sep 02, 2011 @ 18:59:25
Rails 3.1 is out, so no need for rc1 dependency anymore.
Sep 08, 2011 @ 05:50:14
Thank you so much for this fork. Yes, since 3.1 is out, this worked perfectly well for me. No hiccups at all while following the above instructions and got the Team page with AS working.
Only thing I observed was while “bundle install” gemspec warning for active_scaffold:
======================================
active_scaffold_vho at D:/roket/server/ruby-1.9.2-p136/lib/ruby/gems/1.9.1/bundl
er/gems/active_scaffold-5e97c3268715 did not have a valid gemspec.
This prevents bundler from installing bins or native extensions, but that may no
t affect its functionality.
The validation message from Rubygems was:
["frontends/default/images/add.gif", "frontends/default/images/arrow_down.gif"
, "frontends/default/images/arrow_up.gif", "frontends/default/images/close.gif",
"frontends/default/images/close_touch.png", "frontends/default/images/config.pn
g", "frontends/default/images/cross.png", "frontends/default/images/gears.png",
"frontends/default/images/indicator-small.gif", "frontends/default/images/indica
tor.gif", "frontends/default/images/magnifier.png", "frontends/default/javascrip
ts/jquery/active_scaffold.js", "frontends/default/javascripts/jquery/jquery.edit
inplace.js", "frontends/default/javascripts/prototype/active_scaffold.js", "fron
tends/default/javascripts/prototype/dhtml_history.js", "frontends/default/javasc
ripts/prototype/form_enhancements.js", "frontends/default/javascripts/prototype/
rico_corner.js", "frontends/default/stylesheets/stylesheet-ie.css", "frontends/d
efault/stylesheets/stylesheet.css", "frontends/default/views/_render_field.js.rj
s", "frontends/default/views/add_existing.js.rjs", "frontends/default/views/dest
roy.js.rjs", "frontends/default/views/edit_associated.js.rjs", "frontends/defaul
t/views/form_messages.js.rjs", "frontends/default/views/list.js.rjs", "frontends
/default/views/on_action_update.js.rjs", "frontends/default/views/on_create.js.r
js", "frontends/default/views/on_mark_all.js.rjs", "frontends/default/views/on_u
pdate.js.rjs", "frontends/default/views/update_column.js.rjs", "frontends/defaul
t/views/update_row.js.rjs", "lib/active_scaffold/bridges/date_picker/public/java
scripts/date_picker_bridge.js", "lib/active_scaffold/helpers/country_helpers.rb"
] are not files
==================================================
Oct 19, 2011 @ 07:55:30
i get this error:
uninitialized constant ActiveScaffold::Bridges::DatePickerBridge
(in /Users/magnum/.rvm/gems/ruby-1.9.2-p290@rails3/bundler/gems/active_scaffold-094534bb7c6f/app/assets/javascripts/jquery/date_picker_bridge.js.erb)
someone has a solution ?
thanks!
Oct 19, 2011 @ 17:18:34
Hi, works for me. However, it seems that in your case the bridge has nt been loaded yet.
Not sure why and in which case that might happen.
I assume that you have nt explicitly excluded the bridge..
Dec 13, 2011 @ 16:43:34
Hi Volker,
I’ve the same problem. I cannot deploy :
uninitialized constant ActiveScaffold::Bridges::DatePickerBridge
(in …/.rvm/gems/ruby-1.9.3-p0/bundler/gems/active_scaffold-87d0ef321cfa/app/assets/javascripts/jquery/date_picker_bridge.js.erb)
To reproduce (in development using team demo app ) :
RAILS_ENV=development rake assets:precompile
Dec 21, 2011 @ 13:56:53
Hi all,
just committed a fix for this issue to master branch.
Oct 31, 2011 @ 18:54:14
I had the same ‘problem’
For me it turned out that I was requiring all the active scaffold JavaScript for a controller that was NOT an active scaffold controller.
My fix was to not include the line
in the layout file for the page that was NOT the active scaffold page/controller.
HTH
simon
Nov 01, 2011 @ 13:39:35
And that line missing above is
javascript_include_tag “application”
That is the line that should be omitted from any layout file that will be used for a NON active scaffold page
Oct 21, 2011 @ 09:01:15
hi there,
i’ve been trying to get this working on Rails 3.1.1 this morning. i’m running on a Mac using Lion.
i’ve made all the changes as above, and all seems to work perfectly fine except that date fields are appearing as text fields. i assume this has something to do with the date picker bridge.
a quick look at the logs shows the following when i browse to localhost:3000/teams
Compiled jquery/jquery-ui-timepicker-addon.js (0ms) (pid 2486)
AS DatePickerBridge: Can t convert rails date format: %a, %d %b %Y %H:%M:%S %z to jquery datepicker format. Options %c, %U, %W, %w, %x %X, %z, %Z are not supported by datepicker]
Compiled jquery/date_picker_bridge.js (23ms) (pid 2486)
Compiled jquery/tiny_mce_bridge.js (0ms) (pid 2486)
so it looks as though the bridge is loading ok, but the problem may be with the default format of date fields. i’ve not specified any date formats anywhere in the project.
would you have any ideas?
cheers,
-john
Oct 22, 2011 @ 07:40:30
Please define a date/time format in your locale file.
default rails formats are unfortunetly not supported by jquery ui date-/timepicker
eg:
de:
date:
formats:
default: “%d.%m.%Y”
time:
formats:
default: “%m.%d.%Y %I:%M %p”
Oct 21, 2011 @ 15:25:11
Hello,
Thank you for this new update !
I tried it but unfortunately your export plugin doesn’t work with it anymore…
Do you have any plan to update it ? or maybe to release it as part for activescaffold it self ?
Thanks a lot,
regards.
Oct 22, 2011 @ 14:46:29
Hi, unfortuently I did nt have time so far to create a 3.1 version of all my gems.
I do not have any plans to integrate it into activescaffold, cause in my opinion it s a perfect candidate for a extra gem.
Nov 23, 2011 @ 13:53:59
active_scaffold_export_vho gem is available for rails 3.1 as of today.
Dec 29, 2011 @ 02:00:22
I’ve a problem with datetime fields and TimePicker. Here is the Firebug error:
$.datepicker is undefined ($.datepicker._base_selectDate = $.datepicker._selectDate; )
http://127.0.0.1:3000/assets/jquery/jquery-ui-timepicker-addon.js?body=1
Line 785
Dec 29, 2011 @ 11:11:28
Do you see any errors in your log file?
Dec 30, 2011 @ 03:45:20
This is the fresh rails app from your manual + date field. I’ve got this error being reported in firebug at #index from http://127.0.0.1:3000/teams .
$ cat schema.rb
… skip
ActiveRecord::Schema.define(:version => 20111229014259) do
create_table “teams”, :force => true do |t|
t.string “name”
t.integer “position”
t.date “ddd”
t.datetime “created_at”
t.datetime “updated_at”
end
end
$ rails s
=> Booting WEBrick
=> Rails 3.1.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-12-30 13:04:20] INFO WEBrick 1.3.1
[2011-12-30 13:04:20] INFO ruby 1.9.3 (2011-10-30) [x86_64-freebsd9.0]
[2011-12-30 13:04:20] INFO WEBrick::HTTPServer#start: pid=4107 port=3000
Started GET “/teams” for 127.0.0.1 at 2011-12-30 13:39:04 +1000
Processing by TeamsController#index as HTML
(0.2ms) SELECT COUNT(*) FROM “teams”
Team Load (0.1ms) SELECT “teams”.* FROM “teams” WHERE (1=1) ORDER BY “teams”.”id” ASC LIMIT 15 OFFSET 0
CACHE (0.0ms) SELECT “teams”.* FROM “teams” WHERE (1=1) ORDER BY “teams”.”id” ASC LIMIT 15 OFFSET 0
Rendered /home/user/.rvm/gems/ruby-1.9.3-p0@31/gems/active_scaffold_vho-3.1.1/frontends/default/views/_action_group.html.erb (3.6ms)
Rendered /home/user/.rvm/gems/ruby-1.9.3-p0@31/gems/active_scaffold_vho-3.1.1/frontends/default/views/_list_header.html.erb (6.5ms)
Rendered /home/user/.rvm/gems/ruby-1.9.3-p0@31/gems/active_scaffold_vho-3.1.1/frontends/default/views/_list_column_headings.html.erb (23.0ms)
Rendered /home/user/.rvm/gems/ruby-1.9.3-p0@31/gems/active_scaffold_vho-3.1.1/frontends/default/views/_messages.html.erb (0.7ms)
Rendered /home/user/.rvm/gems/ruby-1.9.3-p0@31/gems/active_scaffold_vho-3.1.1/frontends/default/views/_list_messages.html.erb (3.9ms)
Rendered /home/user/.rvm/gems/ruby-1.9.3-p0@31/gems/active_scaffold_vho-3.1.1/frontends/default/views/_list_pagination.html.erb (0.9ms)
Rendered /home/user/.rvm/gems/ruby-1.9.3-p0@31/gems/active_scaffold_vho-3.1.1/frontends/default/views/_list.html.erb (33.0ms)
Rendered /home/user/.rvm/gems/ruby-1.9.3-p0@31/gems/active_scaffold_vho-3.1.1/frontends/default/views/_list_with_header.html.erb (43.0ms)
Rendered /home/user/.rvm/gems/ruby-1.9.3-p0@31/gems/active_scaffold_vho-3.1.1/frontends/default/views/list.html.erb within layouts/application (44.6ms)
Completed 200 OK in 65ms (Views: 59.1ms | ActiveRecord: 0.5ms)
Started GET “/assets/active_scaffold.css?body=1″ for 127.0.0.1 at 2011-12-30 13:39:05 +1000
Served asset /active_scaffold.css – 200 OK (0ms)
Started GET “/assets/jquery_ujs.js?body=1″ for 127.0.0.1 at 2011-12-30 13:39:05 +1000
Served asset /jquery_ujs.js – 200 OK (0ms)
Started GET “/assets/jquery.js?body=1″ for 127.0.0.1 at 2011-12-30 13:39:05 +1000
Served asset /jquery.js – 200 OK (0ms)
Started GET “/assets/application.css?body=1″ for 127.0.0.1 at 2011-12-30 13:39:05 +1000
Served asset /application.css – 200 OK (1ms)
Started GET “/assets/jquery/jquery-ui-timepicker-addon.js?body=1″ for 127.0.0.1 at 2011-12-30 13:39:05 +1000
Served asset /jquery/jquery-ui-timepicker-addon.js – 200 OK (0ms)
Started GET “/assets/jquery/jquery.editinplace.js?body=1″ for 127.0.0.1 at 2011-12-30 13:39:05 +1000
Served asset /jquery/jquery.editinplace.js – 200 OK (0ms)
Started GET “/assets/jquery/active_scaffold.js?body=1″ for 127.0.0.1 at 2011-12-30 13:39:05 +1000
Served asset /jquery/active_scaffold.js – 200 OK (0ms)
Started GET “/assets/application.js?body=1″ for 127.0.0.1 at 2011-12-30 13:39:05 +1000
Served asset /application.js – 200 OK (0ms)
Started GET “/assets/active_scaffold.js?body=1″ for 127.0.0.1 at 2011-12-30 13:39:05 +1000
Served asset /active_scaffold.js – 200 OK (0ms)
Started GET “/assets/jquery/date_picker_bridge.js?body=1″ for 127.0.0.1 at 2011-12-30 13:39:05 +1000
Served asset /jquery/date_picker_bridge.js – 200 OK (0ms)
Started GET “/assets/jquery/tiny_mce_bridge.js?body=1″ for 127.0.0.1 at 2011-12-30 13:39:05 +1000
Served asset /jquery/tiny_mce_bridge.js – 200 OK (0ms)
Started GET “/assets/indicator.gif” for 127.0.0.1 at 2011-12-30 13:39:05 +1000
Served asset /indicator.gif – 200 OK (0ms)
Dec 30, 2011 @ 07:15:56
looks good so far. did you define a date format in your locale file?
Dec 31, 2011 @ 04:08:02
Sorry, I forgot to add the assets build output:
…
Compiled application.css (1095ms) (pid 3068)
Compiled active_scaffold.css (1382ms) (pid 3068)
Compiled application.js (1294ms) (pid 3068)
Compiled jquery.js (168ms) (pid 3068)
Compiled jquery_ujs.js (7ms) (pid 3068)
Compiled active_scaffold.js (66ms) (pid 3068)
Compiled jquery/active_scaffold.js (1028ms) (pid 3068)
Compiled jquery/jquery.editinplace.js (20ms) (pid 3068)
Compiled jquery/jquery-ui-timepicker-addon.js (1ms) (pid 3068)
Compiled jquery/date_picker_bridge.js (7ms) (pid 3068)
Compiled jquery/tiny_mce_bridge.js (926ms) (pid 3068)
Completed 200 OK in 9730ms (Views: 9589.7ms | ActiveRecord: 0.4ms)
Dec 31, 2011 @ 07:53:48
I think your issue is an incorrect application.js file. Can you please compare yours with this one
//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require active_scaffold
//= require_tree .
Dec 31, 2011 @ 04:09:11
Here is locale file:
en:
date:
formats:
default: “%d.%m.%Y”
short: “%d %b”
long: “%d %B %Y”
time:
formats:
default: ‘%d.%m.%Y’
short: “%d %b, %H:%M”
long: “%d %B %Y, %H:%M”
Dec 31, 2011 @ 12:25:42
Bingo! I’ve missed “require jquery-ui” line. You should add this line to your manual too.
Thanks! Happy New Year!