Reputation: 2085
Mac OS X 10.7.3 Lion, Ruby 1.9.2, Rails 3.2.2, Sass 3.2.3
Following this tutorial: http://activeadmin.info/documentation.html
Following this video tutorial http://www.youtube.com/watch?v=tAxlrHcEg9U
I add the activeadmin gem, run bundle install, then run rails generate active_admin:install rails generate active_admin:resource POST
Only after creating the app/admin/posts.rb and trying to run either db migrate rails server
fails with the error
uninitialized constant Post NameError
with out that posts.rb file i am able to run the admin interface error free.
I tried moving the sass-rails gem out side of the :assets in my gem file and re-running bundle install as suggested in another question, but to no avail I still have the error
according to the getting started active admin tutorial "Post" is suppose to be a module name so i assume the code above is calling a class method (ActiveAdmin as the class, register as the method) and sending the module as a parameter and the block do end
Regardless the error is implying that RoR doesn't know what Post is. As if it does not exist. Being new to rails i do not know how to navigate well, meaning i do not even know where this ActiveAdmin source file is in order to dig through it for a method Post
Thank you for the consideration and your time, I appreciate it.
Upvotes: 0
Views: 500
Reputation: 14018
The linked tutorial assumes that you have already created a model named Post
(and have run rake db:migrate
to link it to the database). The purpose of the rails generate active_admin:resource Post
command is to tell ActiveAdmin that you want it to consider the Post model in part of what it does.
Historically, you'll see models like Post and User in Rails a lot -- these are the commonly used examples of creating a blogging application (a user can create blog posts).
So, whatever models you have in your application can be registered with ActiveAdmin by replacing Post
with the name of your model.
Another note: while generators like this tend to be forgiving, a Post is a model that is defined in post.rb
and is linked to a SQL table called posts
. Be careful with things like upper- and lower-case, and singular and plurals. In Rails they all fit together in a special way.
Upvotes: 1