Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Rails 3.1 #103

Closed
gregbell opened this issue May 26, 2011 · 22 comments
Closed

Add support for Rails 3.1 #103

gregbell opened this issue May 26, 2011 · 22 comments
Milestone

Comments

@gregbell
Copy link
Contributor

No description provided.

@gregbell
Copy link
Contributor Author

Discussion thread from #20

@gregbell
Copy link
Contributor Author

gregbell commented Jun 9, 2011

Rails 3.1 support is functioning in the https://github.com/gregbell/active_admin/tree/rails-3-1 branch if anyone's interested in testing it. I would like to run it over a few more apps over the next couple of days before merging it to master

@panva
Copy link

panva commented Jun 10, 2011

The first things i found broken were

i'm building an app from scratch - not updating an existing one

@gregbell
Copy link
Contributor Author

K, so it was functioning with RC1, but looks like there's more issues. I'll take a look at things over the next couple of days.

@panva
Copy link

panva commented Jun 13, 2011

Maybe i missed this but it would be nice to have a way to disable filters or sidebar completely for resources' index page with the next major release

@shedd
Copy link

shedd commented Jun 13, 2011

Greg, I've come across another issue in 3.1.rc4. When I try to view a specific item, the show method throws the following error - it looks like it's confusing the namespace with a column in the DB:

ActiveRecord::StatementInvalid in Admin/users#show

Showing /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/app/views/active_admin/resource/show.html.arb where line #1 raised:

Mysql2::Error: Unknown column 'active_admin_comments.admin' in 'where clause': SELECT SQL_NO_CACHE COUNT(*) FROM `active_admin_comments`  WHERE `active_admin_comments`.`resource_id` = 42 AND `active_admin_comments`.`resource_type` = 'User' AND `active_admin_comments`.`namespace` = `active_admin_comments`.`admin`
Extracted source (around line #1):

1: render renderer_for(:show)
Rails.root: /Users/username/Dropbox/rails/BetDash-Rails3

activerecord (3.1.0.rc4) lib/active_record/connection_adapters/mysql2_adapter.rb:662:in `query'
activerecord (3.1.0.rc4) lib/active_record/connection_adapters/mysql2_adapter.rb:662:in `block in exec_query'
activerecord (3.1.0.rc4) lib/active_record/connection_adapters/abstract_adapter.rb:222:in `block in log'
activesupport (3.1.0.rc4) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activerecord (3.1.0.rc4) lib/active_record/connection_adapters/abstract_adapter.rb:217:in `log'
activerecord (3.1.0.rc4) lib/active_record/connection_adapters/mysql2_adapter.rb:660:in `exec_query'
activerecord (3.1.0.rc4) lib/active_record/connection_adapters/mysql2_adapter.rb:654:in `select'
query_reviewer (0.1.2) lib/query_reviewer/mysql_adapter_extensions.rb:44:in `select_with_review'
activerecord (3.1.0.rc4) lib/active_record/connection_adapters/abstract/database_statements.rb:9:in `select_all'
activerecord (3.1.0.rc4) lib/active_record/connection_adapters/abstract/query_cache.rb:60:in `block in select_all'
activerecord (3.1.0.rc4) lib/active_record/connection_adapters/abstract/query_cache.rb:74:in `cache_sql'
activerecord (3.1.0.rc4) lib/active_record/connection_adapters/abstract/query_cache.rb:60:in `select_all'
activerecord (3.1.0.rc4) lib/active_record/connection_adapters/abstract/database_statements.rb:15:in `select_one'
activerecord (3.1.0.rc4) lib/active_record/connection_adapters/abstract/database_statements.rb:21:in `select_value'
activerecord (3.1.0.rc4) lib/active_record/relation/calculations.rb:216:in `execute_simple_calculation'
activerecord (3.1.0.rc4) lib/active_record/relation/calculations.rb:181:in `perform_calculation'
activerecord (3.1.0.rc4) lib/active_record/relation/calculations.rb:152:in `calculate'
activerecord (3.1.0.rc4) lib/active_record/relation/calculations.rb:58:in `count'
/Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/comments/views/active_admin_comments.rb:20:in `title_content'
/Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/comments/views/active_admin_comments.rb:13:in `build'

@shedd
Copy link

shedd commented Jun 15, 2011

As I've continued my testing of ActiveAdmin on Rails 3.1, I've come across the following deprecation warnings.

DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from <module:ActiveAdmin> at /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/resource_controller/actions.rb:2)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from <module:ActiveAdmin> at /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/resource_controller/actions.rb:2)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from <module:ActiveAdmin> at /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/resource_controller/actions.rb:2)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from <module:ActiveAdmin> at /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/resource_controller/actions.rb:2)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from <module:ActiveAdmin> at /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/resource_controller/actions.rb:2)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from <module:ActiveAdmin> at /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/resource_controller/actions.rb:2)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from block in <module:ActionItems> at /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/action_items.rb:8)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from block in <module:ActionItems> at /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/action_items.rb:8)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from block (2 levels) in define_active_admin_callbacks at /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/callbacks.rb:62)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from block (2 levels) in define_active_admin_callbacks at /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/callbacks.rb:62)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from block (2 levels) in define_active_admin_callbacks at /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/callbacks.rb:62)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from block (2 levels) in define_active_admin_callbacks at /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/callbacks.rb:62)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from block (2 levels) in define_active_admin_callbacks at /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/callbacks.rb:62)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from block (2 levels) in define_active_admin_callbacks at /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/callbacks.rb:62)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from block (2 levels) in define_active_admin_callbacks at /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/callbacks.rb:62)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from block (2 levels) in define_active_admin_callbacks at /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/callbacks.rb:62)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from block (2 levels) in define_active_admin_callbacks at /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/callbacks.rb:62)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from block (2 levels) in define_active_admin_callbacks at /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/callbacks.rb:62)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from block (2 levels) in define_active_admin_callbacks at /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/callbacks.rb:62)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from block (2 levels) in define_active_admin_callbacks at /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/callbacks.rb:62)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from block (2 levels) in define_active_admin_callbacks at /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/callbacks.rb:62)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from block (2 levels) in define_active_admin_callbacks at /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/callbacks.rb:62)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from block (2 levels) in define_active_admin_callbacks at /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/callbacks.rb:62)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from block (2 levels) in define_active_admin_callbacks at /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/callbacks.rb:62)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from block (2 levels) in define_active_admin_callbacks at /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/callbacks.rb:62)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from block (2 levels) in define_active_admin_callbacks at /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/callbacks.rb:62)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from block (2 levels) in define_active_admin_callbacks at /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/callbacks.rb:62)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from block (2 levels) in define_active_admin_callbacks at /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/callbacks.rb:62)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from block in <module:Sidebars> at /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/resource_controller/sidebars.rb:8)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from block in <module:Sidebars> at /Users/username/.rvm/gems/ruby-1.9.2-p180/bundler/gems/active_admin-3e620ebddf5d/lib/active_admin/resource_controller/sidebars.rb:8)

@gregbell
Copy link
Contributor Author

OK guys. I've got an app running on Rails 3.1 now with the rails-3-1 branch. There's still a few deprecation warnings which I should get to shortly, but if you get a chance, take a look and post any issues.

Thanks!

@shir
Copy link

shir commented Jun 21, 2011

Got this error on bundle install (using rails-3-1 branch. Same on master)

Bundler could not find compatible versions for gem "arel":
  In Gemfile:
    activeadmin depends on
      arel (~> 1.0.0.rc1)

    rails (= 3.1.0.rc4) depends on
      arel (2.1.1)

@gregbell
Copy link
Contributor Author

@shir Yes, you need to include the "pre" release version of MetaSearch in your Gemfile

Here is the Gemfile dependencies I've been adding to successfully boot applications in development and production:

  gem "meta_search",    '>= 1.1.0.pre'
  gem "uglifier"
  gem 'sass-rails',     "~> 3.1.0.rc"
  gem 'coffee-script'
  gem 'execjs'
  gem 'therubyracer'

@rsanheim
Copy link

Commenting to follow this. (sigh ...wish github would add watching)

@ambethia
Copy link

@rsanheim, They have. I've been following this ticket since May without having commented. The link to enable notifications for the ticket is right under the comment box. ;)

@eduardordm
Copy link

+1 Following

@ambethia
Copy link

Going to /admin under Pow 0.3.1 and Rails 3.1rc4 results in:

{"name":"NoMethodError","message":"undefined method `length' for #<Arbre::Context:0x000001029e5180>","stack":"/Users/ambethia/Code/grays/books/vendor/ruby/1.9.1/bundler/gems/active_admin-0e23ccbdb170/lib/active_admin/arbre/html.rb:20:in `method_missing'\n/Users/ambethia/Library/Application Support/Pow/Versions/0.3.1/node_modules/nack/lib/nack/server.rb:159:in `block in handle'\n/Users/ambethia/Code/grays/books/vendor/ruby/1.9.1/gems/rack-1.3.0/lib/rack/lock.rb:7:in `block in each'\n/Users/ambethia/Code/grays/books/vendor/ruby/1.9.1/gems/activerecord-3.1.0.rc4/lib/active_record/query_cache.rb:37:in `each'\n/Users/ambethia/Code/grays/books/vendor/ruby/1.9.1/gems/activerecord-3.1.0.rc4/lib/active_record/query_cache.rb:37:in `each'\n/Users/ambethia/Code/grays/books/vendor/ruby/1.9.1/gems/activerecord-3.1.0.rc4/lib/active_record/connection_adapters/abstract/connection_pool.rb:429:in `each'\n/Users/ambethia/Code/grays/books/vendor/ruby/1.9.1/gems/rack-1.3.0/lib/rack/lock.rb:7:in `each'\n/Users/ambethia/Library/Application Support/Pow/Versions/0.3.1/node_modules/nack/lib/nack/server.rb:158:in `handle'\n/Users/ambethia/Library/Application Support/Pow/Versions/0.3.1/node_modules/nack/lib/nack/server.rb:99:in `rescue in block (2 levels) in start'\n/Users/ambethia/Library/Application Support/Pow/Versions/0.3.1/node_modules/nack/lib/nack/server.rb:96:in `block (2 levels) in start'\n/Users/ambethia/Library/Application Support/Pow/Versions/0.3.1/node_modules/nack/lib/nack/server.rb:86:in `each'\n/Users/ambethia/Library/Application Support/Pow/Versions/0.3.1/node_modules/nack/lib/nack/server.rb:86:in `block in start'\n/Users/ambethia/Library/Application Support/Pow/Versions/0.3.1/node_modules/nack/lib/nack/server.rb:66:in `loop'\n/Users/ambethia/Library/Application Support/Pow/Versions/0.3.1/node_modules/nack/lib/nack/server.rb:66:in `start'\n/Users/ambethia/Library/Application Support/Pow/Versions/0.3.1/node_modules/nack/lib/nack/server.rb:13:in `run'\n/Users/ambethia/Library/Application Support/Pow/Versions/0.3.1/node_modules/nack/bin/nack_worker:4:in `<main>'"}

Unsure if it's an ActiveAdmin issue.

@shedd
Copy link

shedd commented Jun 23, 2011

@gregbell - any idea what caused the issue I reported on the 13th?

Mysql2::Error: Unknown column 'active_admin_comments.admin' in 'where clause': SELECT SQL_NO_CACHE COUNT(*) FROM `active_admin_comments`  WHERE `active_admin_comments`.`resource_id` = 42 AND `active_admin_comments`.`resource_type` = 'User' AND `active_admin_comments`.`namespace` = `active_admin_comments`.`admin`

@gregbell
Copy link
Contributor Author

@shedd - None yet. However it looks like its happening in lib/active_admin/comments/views/active_admin_comments.rb on line 24.

@record.active_admin_comments.where(:namespace => active_admin_namespace.name)
# is the same as
@record.active_admin_comments.where(:namespace => :admin)

Is it possible that the Mysql2 driver assumes a symbol is a column? Would you be able to try adding a to_s call in your environment and see if that fixes it?

@nevir
Copy link
Contributor

nevir commented Jul 5, 2011

Just to confirm for myself and anyone new to tracking this - Rails 3.1 support was merged into master, and that's the version we should be testing against?

@gutenye
Copy link

gutenye commented Jul 13, 2011

in 'rails-3-1' branch with rails '~>3.1.0rc'

Bundler could not find compatible versions for gem "arel":
  In Gemfile:
    activeadmin depends on
      arel (~> 2.0.2)

    rails (~> 3.1.0.rc) depends on
      arel (2.1.3)

@nevir
Copy link
Contributor

nevir commented Jul 13, 2011

@gutenye You need to stick gem 'meta_search', '>= 1.1.0.pre' in your Gemfile as well

@olivierlacan
Copy link

Similar issue than @gutenye, I'm on Rails 3.1.0rc4 and when bundle install runs I get:

Bundler could not find compatible versions for gem "arel":
  In Gemfile:
    activeadmin depends on
      arel (~> 1.0.0.rc1)

    rails (= 3.1.0.rc4) depends on
      arel (2.1.3)

@sergiitk
Copy link

@olivierlacan You need to stick gem 'meta_search', '>= 1.1.0.pre' in your Gemfile as well

@gregbell
Copy link
Contributor Author

I'm closing this issue. Any new bugs that come up should be added to their own tickets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests