17

I'm starting with Rails (and I'm also new with Ruby -coming from Python-) and I'm currentrly trying to setup ActiveAdmin for Rails 3.2.3 (Ruby 1.9.3). I'm following this guide but I was not able to run it properly. When I run the rails s command visiting localhost:3000/admin I get

NoMethodError in Active_admin/devise/sessions#new

Showing /home/lex/.rvm/gems/ruby-1.9.3-p125/gems/activeadmin-0.4.3/app/views/active_admin/devise/sessions/new.html.erb where line #11 raised:

super: no superclass method `buttons' for #<ActiveAdmin::FormBuilder:0xb429ae0>

I could not find anything useful on Google, what's wrong here?

If you need more info about this exception please tell me.

Extracted source (around line #11):

8:       f.input :password
9:       f.input :remember_me, :as => :boolean, :if =>  false  #devise_mapping.rememberable? }
10:     end
11:     f.buttons do
12:       f.commit_button "Login"
13:     end
14:   end
  • Please post your view code so we can see the line that's generating the exception. – Brandan Apr 10 '12 at 11:21
  • I've added the source that's raising this exception. BTW there's no custom code, this is the default installation. As you may notice the exception is raised using the built-in ActiveAdmin's devise view. It seems there's nothing such devise:views to extract custom views (but instead they promote the DSL to customize the interface) –  Apr 10 '12 at 12:10
  • Were you able to fix your issue? I am getting the same problem – dennismonsewicz Apr 10 '12 at 15:45
  • I used @landox solution and ran `bundle update formtastic` and this fixed my issue – dennismonsewicz Apr 10 '12 at 15:50

6 Answers6

39

For Rails 4+

If you are running Rails 4+ use f.actions instead of f.buttons. Here's an issue that talks about this change on the ActiveAdmin repo https://github.com/activeadmin/activeadmin/issues/1085

Original answer for OP question in 2012

seems like formtastic 2.2.0 (released today) breaks active_admin and since active_admin requires formtastic >= 2.0.0... put in your Gemfile this

gem "formtastic", "~> 2.1.1"
gem "activeadmin", "~> 0.4.3"

then run

bundle update formtastic

then restart your server (if you have it running)..

and should work ok...

Community
  • 1
  • 1
Orlando
  • 9,374
  • 3
  • 56
  • 53
18

I had same problem and it's killed my about hours.

I am using rails 4 and active admin form master git:

gem 'activeadmin', github: 'gregbell/active_admin'

I just used "f.actions" instead of "f.buttons"

form do |f|
  f.inputs "Enter Todo details" do
    f.input :quote_id, :as => :select, :collection => Quote.all.map {|q| [ q.contact,q.id]}, :include_blank => false 
    f.input :name, :label => "Name of customer"
    f.input :state, :as => :select, :collection => ['Active','Closed'], :include_blank => false
    f.input :moving_date
    f.input :revisit
    f.input :address
    f.input :status
  end
  f.actions
end

It's works for me.

Pravin Mishra
  • 8,298
  • 4
  • 36
  • 49
1

I have done following changes in the gemfile

gem 'activeadmin', '0.4.2' gem 'formtastic', '2.0.0'

and it solved the same issue.reason is same as explained above .the formtastic 2.2.0 is incompatible with activeadmin current version

1

I followed the instructions above, but the same error kept popping up. It resolved itself after I closed and reopened rails server, but just a note to anyone else that has this problem; make sure you restart the server. :)

mitchmonsen
  • 105
  • 2
  • 10
  • 1
    yeah totally.. when you install a new gem you have to restart the server.. ill add this to the answer.. – Orlando Apr 11 '12 at 17:03
0

Did you run the 'bundle' command to fetch the necessary gems and dependancies (ActiveAdmin, Formtastic, etc.)? It's a common mistake when starting rails.

  • Sure, I did. It installed all dependencies including `formtastic (2.2.0)`. –  Apr 10 '12 at 12:55
0

I inherited a project written around July 2012 that uses ActiveAdmin 0.4.0 and formtastic-bootstrap (off Git).

Due to URL-generating bugs in that version of AA I upgraded to 0.5.0, but now I get the superclass error. Anyone know what I should do about this line:

gem 'formtastic-bootstrap',   :git => "git://github.com/cgunther/formtastic-bootstrap.git", :branch => "bootstrap-2"
rptwsthi
  • 10,094
  • 10
  • 68
  • 109
Eric
  • 2,115
  • 2
  • 20
  • 29