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

My experience setting up activeadmin-mongoid for rails 4 #78

Closed
pencilcheck opened this issue May 16, 2014 · 9 comments
Closed

My experience setting up activeadmin-mongoid for rails 4 #78

pencilcheck opened this issue May 16, 2014 · 9 comments

Comments

@pencilcheck
Copy link
Contributor

Just to share this with you guys the steps I take to resolve errors I have encountered when setting up activeadmin-mongoid for rails 4.1.1

You need those gems in Gemfile:

gem 'devise'
gem 'activeadmin', github: 'gregbell/active_admin'
gem 'activeadmin-mongoid', github: 'elia/activeadmin-mongoid', branch: 'rails4'

  • somehow devise is not included as part of activeadmin dependency, so have to add it manually

This issue #76 can be solved by following @djsmentya's answer at heartcombo/devise#2949

Follow this SO answer to avoid activeadmin.css taking over app's css
http://stackoverflow.com/a/11745446/1742820

Follow @funfun's answer in the link below to fix the "undefined method `object' for #Mongoid::Criteria:0x.." I guess from formtastic
#52

Hopefully this issue would help out wandering google searching souls trying to make activeadmin-mongoid work on rails4

I would appreciate if the support for rails4 can benefit from this report. Because this is definitely not straightforward...

@pencilcheck
Copy link
Contributor Author

Getting errors on find_by_[:id] when trying to edit a resource, trying to figure out how to fix that.

@pencilcheck
Copy link
Contributor Author

Found a solution to the problem: just add the line
self.primary_key = 'id' in the model class after include.

@pencilcheck
Copy link
Contributor Author

Found a cleaner solution than the one above in this issue #79

@rocknrollMarc
Copy link

Wow thanks that just made my day :)

@kinfante
Copy link

@pencilcheck thanks man!!
question: is there a way to make search filters work?
just showing buttons "Filter" and "Clear Filters" here.. even forcing "filter :field"

@pencilcheck
Copy link
Contributor Author

Search filter is not supported because the original repo uses the version of ransack which does not support NoSQL such as mongoid, if we want filter to work then someone has to find a replacement for that.

@ni-ka
Copy link

ni-ka commented Jul 24, 2014

Well, I tried to follow your steps... but when I start my server I get:

/Users/nils/Documents/projects/seensucht/server/bin/rails:6: warning: already initialized constant APP_PATH
/Users/nils/Documents/projects/seensucht/server/bin/rails:6: warning: previous definition of APP_PATH was here
Usage: rails COMMAND [ARGS]

The most common rails commands are:
 generate    Generate new code (short-cut alias: "g")
 console     Start the Rails console (short-cut alias: "c")
 server      Start the Rails server (short-cut alias: "s")
 dbconsole   Start a console for the database specified in config/database.yml
             (short-cut alias: "db")
 new         Create a new Rails application. "rails new my_app" creates a
             new application called MyApp in "./my_app"

In addition to those, there are:
 application  Generate the Rails application code
 destroy      Undo code generated with "generate" (short-cut alias: "d")
 plugin new   Generates skeleton for developing a Rails plugin
 runner       Run a piece of code in the application environment (short-cut alias: "r")

All commands can be run with -h (or --help) for more information.```

@ni-ka
Copy link

ni-ka commented Jul 24, 2014

Looks like that went away when I reran the devise generator...

@pencilcheck
Copy link
Contributor Author

I believe if you follow my spec here, you don't need any patch at all, except maybe this snippet from this issue heartcombo/devise#2949:

#HACK FOR DEVISE 3.2.4
def self.serialize_into_session(record)
    [record.id.to_s, record.authenticatable_salt]
end

In the user class used for devise

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

4 participants