rails server won't start because ActiveAdmin Comment change - ruby-on-rails-4

I'm trying to start a rails app (4.1.8), using activeadmin version from gregbell/activeadmin in my Gemfile. On startup rails first complained "config.allow_comments is no longer provided in ActiveAdmin 1.x. Use config.comments instead. (RuntimeError)" So I changed to config.comments in active_admin.rb, tried to restart and now I get:
You're trying to register ActiveAdmin::Comment as Comment, but the existing ActiveAdmin::Resource config was built for Comment! (ActiveAdmin::ResourceCollection::ConfigMismatch)
What gives, anyone see this before and know how to fix it? Seems like there's no change in active_admin and now suddenly this.
Many Thanks for any advice.
UPDATE:
For anyone with the same issue, I solved it by changing the activeadmin Comment class like this:
change
ActiveAdmin.register Comment do
to this
ActiveAdmin.register Comment, as: "UserComment" do
as mentioned in the comments here: https://github.com/activeadmin/activeadmin/issues/301

...posting my own answer to this question... I had to change the signature of the activeadmin Comment class as mentioned in my update above. It came from the comments here: https://github.com/activeadmin/activeadmin/issues/301

Related

New rails 4.1 mailer preview action not found error

Rails has 607 open issues...so, rather than plugging that hole even more I though Id try here first. I have upgraded to 4.1 and am implementing rails mailer previews. I tried upgrading my existing mailer and adding tests/mailers/previews directory. When that gave the following error I tried generating a new mailer. Same error.
class NotifierPreview < ActionMailer::Preview
def welcome
Notifier.welcome(User.first)
end
end
results in this error:
The action 'notifier' could not be found for Rails::MailersController
I've tried searching google, the docs, stack overflow, but nothing eludes to this error.
Anyone experience this or have any ideas?
The default preview path is /test/mailers/previews but rspec will override this to be /spec/mailers/previews
You can set the path to be whatever you like with:
config.action_mailer.preview_path = "#{Rails.root}/test/mailers/previews"
This is because you are using UserMailer with NotifierPreview. Change NotifierPreview to UserMailerPreview and it will start working. Check the example implementation https://github.com/RichIsOnRails/ActionMailerPreviewsExample and tutorial.
Cheers!!
If you're using rspec, make sure that the rspec-rails gem is being loaded in the development environment, otherwise Rails will look for the previews under the /test folder, not /spec.
Remove the line(s)
get '/:controller(/:action(/:id))'
get '/:controller(/:action(/:id))(.:format)'
from your routes.rb
As #hellion says in a comment on the previous answer this is the solution to this problem.

Mongoid 4 finding embedded documents by ID

I have a project that is my first serious dive into Mongoid.
I saw a tip to use the following command:
Parent.where('childrens._id' => Moped::BSON::ObjectId(params[:id])).first
But this doesn't work. Error message was:
NameError: uninitialized constant Moped::BSON
I found that BSON is no longer included, so I added it to my Gemfile, as well as Moped. Then, I did another fix I found (placing Moped::BSON=BSON in application.rb).
This still didn't work, but the error changed to:
NoMethodError: undefined method `ObjectId' for BSON:Module
So I am assuming that this method got deprecated or something. Does anyone have any other tips?
Just to be clear, I am finding myself in the situation where I want to sort embedded documents using jquery-sortable. This requires me to update them in the database, but the serialize from that doesn't include the parent document in the hash. So I figured I'd try to get it on the back end using an ID from the embedded document. That is why I need it.
Thanks again for any help you can provide.
Try simply:
Parent.where('childrens._id' => params[:id]).first
I have solved the question though this won't be of much help to people in the future. The requirements have changed and now I am using human-readable strings as IDs to assist in friendly URLs and some other stuff.
Therefore, I don't have any issues with ObjectIds. Cortex's solution should (from what I have read) work for dealing with ObjectIds but I cannot verify it now.

Using multiple jQuery versions problem

I am building control that uses last version of jstree. Problem is that whole system is build using jQuery 1.3.2, but i need to use jQuery 1.4.2 for jstree, also to prevent errors need "$" still pointing to jQuery 1.3.2 to make system works normally. I tried to solve problem like this
var jq142 = jQuery.noConflict(true);
And it works, but when i added other control to form like "datepicker" that initialized via $("#id").datepicker it throws error $("#id").datepicker is not a function
When i inspect DOM variables through firebug all is ok - $ is pointing to 1.3.2 and datepicker function is registered.
What it can be?
Thanks
in case anyone came to this by looking for unanswered questions, the answer was to simply upgrade to 1.4.*
btw: jQuery 1.7 has just been released... time to upgrade again ;-)

Django AdZone and problem in the admin

im would like to use the cool app Django-AdZone, i thinks is a nice work , but i have a litter problem:
i have 2 website, django-adzone is working very nice in one of those website, but in the second website is not working.
I cant see in the django admin the app adzone, i dont know why, i did the same steps for both website, and the second website is not showing the adzone in the admin, the settings.py are similar with relation to adzone.
Any idea?
thanks guys
sorry with my english
ok, now i know where is the error, is not django , is python2.5, here is the error while install
return self.loader.get_data(path)
zipimport.ZipImportError: bad local file header in /home/bismark/lib/python2.5/d jango_adzone-0.2-py2.5.egg

Anyone using JRuby-Rack with Rails 3?

Is anyone else out there running Rails 3 and JRuby-Rack, or Jetty and Rails 3? Any trick to it? I'm going insane with some debugging, and at this point I just want to know that it's possible.
These instructions work for me:
http://mathias-biilmann.net/2010/2/jruby-and-rails-3-beta-step-by-step
i am using jetty-rails + rails3 for a couple of projects. jetty-rails need to be fixed , require "activesupport" need to be changed to require "active_support" (for activesupport 3.0.3) and you have also do 'require "active_support/all"' to include hash extensions (otherwise symbolize! & reverse_merge method will raise exceptions.. right now trying to fix some jruby-rack issues.. (Rack::Runtime not loaded)..will update once thats done.