Rails 3.0 RC2 was recently released and it seems that we are really close to the official launch of Rails 3.0
I ve got great news for those of you who have already been using the ActiveScaffold Plugin with previous Versions of Rails:
If you are interested in using Rails 3.0, you just can do it.
Let me guide you through the few steps to setup up a Rails 3 project with ActiveScaffold.
Setup Rails 3 project (detailled instructions):
- rails new howto
- cd howto
- bundle install
- rake db:create
Setup ActiveScaffold (you will need a running git bash):
- rails plugin install git://github.com/vhochstein/active_scaffold.git -r ‘rails-3.0’
- rails g active_scaffold_setup [prototype| jquery]
Your choice if you would like to use prototype or jquery. Thanks to Rails 3.0 and the new unobtrusive Javascript approach. If you are asked if you would like to overwrite rails.js just say yes.
Setup two activescaffolds:
- rails g active_scaffold Team name:string position:integer
- rails g active_scaffold Player name:string injured:boolean salary:decimal date_of_birth:date team:references
- rake db:migrate
- edit file app/models/team.rb -> has_many :players
- rails s
- Open Browser: http://localhost:3000/teams
That ‘s it. You ve got a running application to CRUD teams and players using Rails 3 and ActiveScaffold.
ActiveScaffold Using Dates with JQuery « Vhochstein's Blog
Sep 18, 2010 @ 11:12:07
Matthew Forsyth
Sep 21, 2010 @ 02:17:26
Hi –
Currently, if I run these commands exactly as printed, I get this response from my request to the “teams” controller:
undefined method `offset’ for #
Here’s the output in the log:
Started GET “/teams” for 127.0.0.1 at Mon Sep 20 22:15:01 -0400 2010
Processing by TeamsController#index as HTML
SQL (0.2ms) SELECT COUNT(*) AS count_id FROM “teams”
SQL (0.1ms) SELECT name
FROM sqlite_master
WHERE type = ‘table’ AND NOT name = ‘sqlite_sequence’
Completed in 5ms
NoMethodError (undefined method `offset’ for #):
Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.0.0/lib/action_dispatch/middleware/templates/rescues/_trace.erb (0.9ms)
Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.0.0/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (6.5ms)
Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.0.0/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (11.3ms)
vhochstein
Sep 23, 2010 @ 06:51:53
I would say you ve found an ActiveRecord Bug: offset can t be the first method for building up Arel statements.
I ve added a patch to ActiveScaffold a few minutes ago to fix this.
Thanks a lot.
Abder-Rahman
Sep 22, 2010 @ 19:19:44
When I run the following command:
rails g active_scaffold_setup [prototype| jquery]
I get the following:
C:\Users\Abder-Rahman\Desktop\howto>rails g active_scaffold_setup [prototype| jq
uery]
‘jquery]’ is not recognized as an internal or external command,
operable program or batch file.
Why is that?
Thanks.
vhochstein
Sep 22, 2010 @ 20:02:04
Because [prototype|jquery] means that you have to choose between the two options
If you would like to use prototype:
rails g active_scaffold_setup prototype
for jquery:
rails g active_scaffold_setup jquery
Abder-Rahman
Sep 23, 2010 @ 09:07:06
Thanks for your reply.
Abder-Rahman
Sep 22, 2010 @ 21:12:26
I got the command run after cloning the plugin from git and manuallly
moving it to vendor/plugins in the Rails application folder.
Thanks.
Abder-Rahman
Sep 23, 2010 @ 09:24:47
I’m trying to clone: git://github.com/vhochstein/active_scaffold.git
Which I did successfully yesterday (Wednesday), but today (Thursday) when I’m rubnnung this command in the git bash:
$ git clone git://github.com/vhochstein/active_scaffold.git
I get:
Cloning into active_support…
github.com[0: 207.97.227.230]: errno=Invalid arguments
fatal: unable to connect a socket (Invalid argument)
vhochstein
Sep 23, 2010 @ 12:22:39
I would assume that something was temporarily broken either on github side or on your side.
Just tried to clone and at least for me it worked.
Abder-Rahman
Sep 23, 2010 @ 15:23:46
I was doing that from my Father’s office where he works, and seems that there are some restrictions on connections.
Thanks.
Abder-Rahman
Sep 23, 2010 @ 16:50:11
When you mention:
team:references
Is this like a foreign key to the “Teams” table?
Thanks.
vhochstein
Sep 23, 2010 @ 17:52:15
That s pure rails. Take a look at http://guides.rubyonrails.org/migrations.html for details.
Abder-Rahman
Sep 24, 2010 @ 07:33:07
I used ActiveScaffold to create my Rails application.
After I fill the fields and try to “Create” the new data, I get the
following:
Request Failed (code 500, Internal Error) Close
I don’t know if this is caused by the “Date” field, which its value
looks like this:
Wed, 15 Sep 2010 00:00:00 %z
And, really don’t know what “%z” is, why it appears, and how to remove
it.
Any ideas on that?
Thanks.
vhochstein
Sep 24, 2010 @ 10:27:47
jquery datetime picker does not support all the date formatting options that rails provide. 😦
Default Time Format in Rails includes %z, which represents the time zone and time zone is not supported by jquery datetime picker.
Therefore I would suggest to change your default rails time format to something like:
“%d.%m.%Y %H:%M” in your rails config localization file.
For more details please have a look at:
Actionlink response and ignore « Vhochstein's Blog
Sep 30, 2010 @ 18:59:44
John Henderson
Oct 05, 2010 @ 01:59:03
hi there,
i’ve tried this a few times, and keep coming up with the same problem… the AS works perfectly except that the player’s date of birth is shown as a text box instead of a date/time picker. and there seems to be a lot more vertical space between the fields than i’m used to seeing. also, when i did the “rails plugin install git://github.com/vhochstein/active_scaffold.git” i get an error at the end:
Initialized empty Git repository in /Users/John/dev/howto/vendor/plugins/active_scaffold/.git/
remote: Counting objects: 325, done.
remote: Compressing objects: 100% (293/293), done.
remote: Total 325 (delta 35), reused 196 (delta 12)
Receiving objects: 100% (325/325), 208.63 KiB | 72 KiB/s, done.
Resolving deltas: 100% (35/35), done.
From git://github.com/vhochstein/active_scaffold
* branch HEAD -> FETCH_HEAD
Plugin not found: [“git://github.com/vhochstein/active_scaffold.git”]
which is strange, because it does seem to install everything, and it pretty much works – except for the date/time picker that is…
vhochstein
Oct 05, 2010 @ 12:11:49
Please make sure, that calender_date_select plugin is installed in case of prototype.
anselm
Nov 05, 2010 @ 18:26:18
When I do
rails plugin install git://github.com/vhochstein/active_scaffold.git
It does install more or less but the last line from git is:
Plugin not found: [“git://github.com/vhochstein/active_scaffold.git”]
I’m assuming it more or less installs? Maybe some other plugin dependency is missing? If I just ignore and continue then when I try :
rails g active_scaffold_setup jquery
I get
could not find https://github.com/vhochstein/jquery-ujs/raw/master/src/rails.js
If I try
rails g active_scaffold_setup prototype
I get the same error.
If I uninstall this and try via https:// rather than via git:// I get the same error.
But the file it is looking for is there. *ALTHOUGH* the github certificate is signed wrongly – if I do this with wget it complains and refuses to fetch the file. Interestingly if I fetch it with wget even with just http:// and not https:// it still complains about the certificate (what!?).
Anyway, the same error occurs on different machines, different operating systems and different networks.
Also, separately – what if I don’t want to make a new record but simply instrument an existing one? I suppose I can read the manual.
Good luck,
MrP
Nov 24, 2010 @ 10:40:08
Same problem here.
When I try rails generate active_scaffold_setup prototype I get this error:
Could not find "https://github.com/vhochstein/prototype-ujs/raw/master/src/rails.js" in any of your source paths. Your current source paths are:
PATH_TO_MYAPP/lib/templates/rails/active_scaffold_setup
PATH_TO_MYAPP/vendor/plugins/active_scaffold/lib/generators/active_scaffold_setup/templates
Same problem if I try JQuery.
I manually copy the rails.js file in the first folder, but the error persists.
vhochstein
Nov 24, 2010 @ 17:50:58
Well, that s happening because github switched completely to https and thor gem does not support https downloads in old versions. Please try updating your thor gem to solve your issue
MrP
Nov 26, 2010 @ 11:19:23
It works.
Thanks a lot.
ActiveScaffold FieldSearch with default search condition « Vhochstein's Blog
Nov 11, 2010 @ 19:24:17
Eugene
Nov 20, 2010 @ 13:36:35
Hi, I have everything working but with only one problem – no ajax. So is it something I did wrong or it should be without ajax?
vhochstein
Nov 20, 2010 @ 17:09:04
Please verify that all javascript files are loaded and that javascript execution is nt blocked by browser plugins such as noscript.
If that does nt help please open an issue in github and please include your environment such as ruby version, prototype or jquery and which browser.
And a please explain a little bit what no ajax means.
Thanks a lot
Eugene
Nov 20, 2010 @ 20:58:39
Hi,
if you’ll go here http://demo.activescaffold.com/users you will see that almost all actions performs using ajax (sorting, creating new item and so on), but in my project every action reloads the page.
But anyway thanks for quick reply, I will open an issue.
naoki
Nov 27, 2010 @ 19:48:37
Everything works but the nested link of players. I’ve created a team with 3 players. But when I click the players nested link the players list doesn’t not always appear.
I tried quite a few times. This is quite strange. And if I click nested players link after click edit and then cancel it, the players list always appears.
activescaffold is the latest commit on Nov 26th
MacOS 10.6.5
Rails 3.0.3
ruby 1.8.7 (2009-06-12 patchlevel 174)
Firefox 3.6.12
vhochstein
Nov 29, 2010 @ 07:49:48
Thanks for reporting. Seems I ve introduced this bug during development of the new grouped action feature. Sorry, for that. Should be fixed now.
PanosJee
Nov 29, 2010 @ 09:51:12
Hey that s great that you ported AS to Rails 3. Just a small hint for people who may not used AS before.
They should add in application.html.erb
PanosJee
Dec 30, 2010 @ 14:20:32
Sorry I just forgot it :
Mike
Dec 17, 2010 @ 01:56:04
Everything works for me, except nothing updates when I add a new row or update an existing row. I don’t get error messages when my validations fail and the updated row doesn’t collapse into the list like it does on 2.3. Any ideas?
Here’s what my layout looks like (the css/js part in haml):
= stylesheet_link_tag :all
= stylesheet_link_tag ‘http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/ui-lightness/jquery-ui.css’
= javascript_include_tag ‘http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.js’
= javascript_include_tag ‘rails_jquery.js’
= javascript_include_tag ‘http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/jquery-ui.js’
= javascript_include_tag ‘jquery-ui-timepicker-addon.js’
= javascript_include_tag ‘application.js’
= active_scaffold_includes
= csrf_meta_tag
vhochstein
Dec 18, 2010 @ 13:58:24
Please make sure that you are using correct rails.js file: https://github.com/vhochstein/jquery-ujs/blob/master/src/rails.js
Mike
Dec 19, 2010 @ 14:40:09
Still not working… I’m using that rails.js file (and installed the plugin you linked to, ran the tests, and they all passed).
vhochstein
Dec 20, 2010 @ 09:24:24
Please open an issue.
Cilantro
May 09, 2011 @ 08:59:10
I’m running into the exact same issue — something seems to go wrong with my jquery setup and the Ajax updates after create, delete, etc. aren’t working. Did you ever figure out what was causing this in your app?
Mike
May 09, 2011 @ 12:03:50
I never fixed the issue that I was talking about here, but I’ve installed ActiveScaffold on new Rails 3 apps and it’s worked fine. At some point I’ll have to go back and see what the differences are, but for now the non-AJAX CRUD operations aren’t too bad.
Mark McDonald
Dec 26, 2010 @ 16:10:30
Thanks for this update. Works great on Ubuntu 10.04 + rails3
Happy new year!
soend
Jan 18, 2011 @ 20:53:29
I did everything like it says here on the post but active_scaffold didnt create any views? Any clue what might be wrong?
vhochstein
Jan 19, 2011 @ 17:47:24
Please try out: https://vhochstein.wordpress.com/2010/10/08/one-step-rails-app-with-activescaffold-installation/ and please check if that one is working.
Johan
Jan 19, 2011 @ 04:57:02
I had the same problem as a couple of others reported – the “Search” link and others opened in a new window instead of on top of the AS. It turns out to be that I had jQuery.noConflict(); enabled as part of a previous installation, when that was needed to not conflict with prototype. Now everything works great.
Thanks for the awesome work
Cheers
Johan
コンピューターと人の触媒になるのを目指して » Twitter Updates for 2011-01-29
Jan 29, 2011 @ 03:29:15
Eric
Jan 31, 2011 @ 00:58:02
Nice! Tried it with prototype n’ rails 3.0.3 – only glitch was that the field name date_of_birth didn’t work – changed it to fodelsedatum (swedish for date_of_birth 🙂
Need to upgrade a rails 1.1.2 app that uses ajaxscaffold to rails 3 so I’m happy I found this!
Cheers,
Eric
vhochstein
Feb 01, 2011 @ 07:07:14
HI Eric,
can you please tell me why date_of_birth did nt work? Thanks a lot.
Eric
Feb 01, 2011 @ 11:51:53
I’ve got an error when running db:migrate – date was invalid field type, just tried on another machine and now it works with date_of_birth . The only glitch now is that it’s using text_field and not date picker for birth date.
vhochstein
Feb 01, 2011 @ 18:23:25
Do you use prototype or jquery?
In case of prototype you have to install calendar_date_select plugin
in case of jquery datepicker should pop up if you click into textfield.
If that s not the case please check that all js files are successfully loaded by your browser
Jose Juan
Feb 07, 2011 @ 19:17:45
Despues de mucho buscar implementar Activescaffold por fin este tutorial me funciono a la primera, felicidades y saludos desde Mexico
Rex
Mar 03, 2011 @ 06:24:03
It’s possible I’m doing something silly (I’m very much a novice) and it’s likely nothing to do with active_scaffold_vho, but the sortable column headers seem to act wonky unless I use jquery when I run active_scaffold_setup.
If I create the team/player example app using prototype, clicking on the column headers in the teams index doesn’t change the sort order on the clicked column (it appears to change the order on the PREVIOUS column you clicked on).
I’m using the gem rather than a plugin, but otherwise just following the instructions above. It happens with either safari or firefox.
vhochstein
Mar 03, 2011 @ 18:23:42
Hm, just tried it out and works for me even with prototype. I can click name, position,… columns and everything is sorted as expected.
Rex
Mar 04, 2011 @ 22:39:43
I just upgraded everything to ruby 1.9.2 and rails 3.0.5 and I’m still seeing the issue.
I posted a video of the weirdness on youtube
Jump to 4’53” to see the bug manifest (the earlier part is just setup).
Despite what I said earlier, the problem only seems to manifest with safari and not with firefox. So I suspect this is just some prototype/webkit bug and nothing to do with active_scaffold.
vhochstein
Mar 05, 2011 @ 09:02:59
I would call it a bug. 🙂 Not sure which component is responsible. Can you please open an issue at github. Thanks a lot.
Ryan Angilly
Mar 23, 2011 @ 17:35:08
This is some great stuff. Is there a reason this hasn’t been merged into the canonical repo at https://github.com/activescaffold/active_scaffold?
I would at least have expected a rails3 branch there.
vhochstein
Mar 24, 2011 @ 07:33:02
Let me give you a really short answer: I do not see a benefit and nobody else did it so far. My little activescaffold eco-system is offering me all I need, if somebody else thinks it s useful for him… Great, please use it. If you would like to contribute. Great, please do it. If you would like to contribute to the official activescaffold project. Great, please do that. Activescaffold is an awesome tool.
Quike
Mar 31, 2011 @ 23:16:54
How localize change css on activescaffold_vho
vhochstein
Apr 02, 2011 @ 17:57:11
Just create another css file which you load after activescafffold css file and include all your changes there.
Hope that helps.
Lee
Apr 18, 2011 @ 21:03:47
I’m new to Rails and AS. I have AS working with 1:M relationships, but am having trouble with M:M relationships. I found a lot of related posts but suspect many of them are obsolete with Rails 3 and the new AS. Can you please point me to the proper approach/examples? I need the join table to have a custom name and additional tracking fields.
Thanks for any help and your great work.
vhochstein
Apr 19, 2011 @ 06:24:09
Hi,
n:m tables with extra attributes are in my view independent models, so I normally treat them as two 1:n relations.
If these extra attributes are not user editable it s getting interesting. Cause has_and_belongs_to_many does not work in that case and Activescaffold is nt helping you out of the box for that scenario.
I would suggest to post to the activescaffold group. I bet somebody can help you there.
Michael Richardson
May 25, 2011 @ 20:07:10
I’d rather keep active_scaffold in .gitmodules, but that means that I can’t hack the active_scaffold_env.rb to pick jquery. I have been trying to put it into config/initializers, but failing. Is there a canonical way do this?
vhochstein
May 26, 2011 @ 10:44:13
I would recommend to include it as a gem, please see my related post: https://vhochstein.wordpress.com/2011/02/12/activescaffold-gem/
One Step rails app with activescaffold installation « Vhochstein's Blog
May 27, 2011 @ 12:51:01
Jan Hebler
Jun 05, 2011 @ 05:21:30
Hi
The original active-scaffold shows an spinner while processing Live-Search. Any Chance to get them back?
Thanks Jan
vhochstein
Jun 06, 2011 @ 11:24:39
sure, please open an issue in github issue tracker and either fix it and send a pull request (quickest path to get you a solution) or wait until somebody fixes that specific issue.
Hope that helps.
Jay S.
Jun 13, 2011 @ 21:04:52
Hi, during the installation, I received the following errors:
$ rails plugin install git://github.com/vhochstein/active_scaffold.git -r ‘rails-3.0′
Initialized empty Git repository in /Users/stricksjw/Dev/infra/vendor/plugins/active_scaffold/.git/
fatal: Couldn’t find remote ref ‘rails-3.0′
I then repeated without the “rails-3.0′ at the end of the command, and installation cooperated.
However, when I executed:
$ rails g active_scaffold_setup jquery
I received the following traceback:
/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/lib/active_support/core_ext/module/aliasing.rb:31:in `alias_method’: undefined method `render’ for class `ActionView::Renderer’ (NameError)
…
Any ideas why this is happening?
Thanks a lot!
vhochstein
Jun 14, 2011 @ 07:05:34
Works for me. No idea why it isnt working for you. Have you tried integrating as a gem ?
Do you need to add these backticks?
If you do not specify rails 3.0 branch you are on rails-3.1 and that one is not compatible to rails 3.0
Jay S.
Jun 14, 2011 @ 15:21:26
Hey, I really can’t thank you enough for the quick reply. It was definitely the backtick (instead of a single quote) causing the problem. I went to an earlier version of my app, reinstalled AS using the same commands but with correct punctuation, and things are working well.
BTW, I googled around trying to solve the problem and it may be that other folks getting that same
<> error may have copied/pasted the lines of code in this post too liberally, as I did. Just a guess, but I’m glad it all worked itself out. Now on to using AS!
guest
Jun 16, 2011 @ 07:41:41
really , thanks a lot. i spent my a lot of time in resolving the issue thinking that the copied code was correct. but the problem was that backtick. Using single quote , its working now. i request the people please check before posting the code because it make a lot of trouble for others if not correct.
majin.jp » 覚書
Jul 01, 2011 @ 11:06:34
Pass the Activescaffold please « BackyardRocket.com
Aug 08, 2011 @ 00:30:40
jj
Aug 27, 2012 @ 21:04:47
yes but after scaffolding with active_scaffold, where do go to modify controllers, views ?
jj
Aug 27, 2012 @ 21:07:31
commenting again because i forgot to set email notifying of replies in my previous comment 🙂