Active_admin: ArgumentError in Admin/events#index - ruby-on-rails-3

I've just installed active_admin and created the first resource - videos - perfectly find. Everything worked like a charm.
But now that I'm trying to add 'users' and 'events' it is failing with the same message when I navigate to them in the menu.
Here is what it says:
ArgumentError in Admin/events#index
Showing /Users/markwalker/.rvm/gems/ruby-1.9.3-p327/gems/activeadmin-0.5.1/app/views/active_admin/resource/index.html.arb where line #1 raised:
wrong number of arguments (3 for 1)
Extracted source (around line #1):
1: insert_tag renderer_for(:index)
Rails.root: /Users/markwalker/Xavy2
Application Trace | Framework Trace | Full Trace
app/helpers/application_helper.rb:3:in `select_tag'
Request
`Parameters`:
{"order"=>"id_desc"}
Has anyone experience this before, or have an idea about what might be causing it?
Let me know if I need to add more code to make sense of the problem.
Thanks in advance for any help...

Couple observations, jfdimark
Shouldn't {"order"=>"id_desc"} be {"order"=>"id desc"} (no underscore)?
Apart from that, it's hard to diagnose without seeing the Full Trace. A similar problem with ArgumentError in Admin/dashboard#index brought me to your question in the first place, but simply looking at my Full Trace I saw:
RedCloth (4.2.9) lib/redcloth/erb_extension.rb:16:intextilize'`
as the first line. I actually wasn't using RedCloth in this project, so I took it out of my Gemfile and all's good.

Related

form_for doesn't save to db

I have a very basic Rails application that has some standard scaffolded CRUD resources that worked just fine. All of a sudden, and I can't figure out why, the "form_for"s are no longer saving or updating the DB. However, everything works just fine in console. I am getting no errors -- just a redirect back to the 'new' page because of an unsuccessful save attempt. I've restarted servers, restarted everything, bundled again, migrated, etc. Nothing seems to work. How can I debug this issue?
Try temporarily changing #model.save to #model.save! in one of the relevant controllers.
This tells Rails to throw an exception if saving fails, instead of it's usual approach (redirecting to new, usually). Most likely you have a validation error, but whether or not that's the case, if you do this, you'll get an actual description of the error that occurred when the controller tried to save your updated model. That should give you somewhere to start debugging.

Dojo console error objects empty

All of a sudden the errors that Dojo (1.8.3 from Google CDN) is spitting out empty errors, which makes debugging impossibly hard. For example, if I forget to require a dependent before using it, I get the usual
> dojo/parser::parse() error ReferenceError {}
... in the error console, but I remember getting more information in the ReferenceError (spindown arrow was present), giving me the arguments of the error as well as the message making it easy to figure out what I had done wrong.
I have isDebug : true in my dojoConfig, but it just doesn't want to tell me anything anymore.
What gives?
I've been having the same problem using Dojo 1.8.3 as well. When I close my developer tool's console and then re-open it the Error had the spindown and more details as expected. Seems stupid, but give it a try and see if that at "fixes" it for you. I planned on digging a little further into this later, so if I find any additional details I will make sure to update my answer with them.

WCF message routing debugging error - Multiple headers

I'm trying to understand WCF message routing, so I'm trying to recreate a sample passthrough router that I found in order to understand the pieces. The problem is that when I run mine in the debugger, I get the exception:
Multiple headers with name 'VsDebuggerCausalityData' and namespace 'http://schemas.microsoft.com/vstudio/diagnostics/servicemodelsink' found.
I've read that this is because I'm debugging all the pieces at the same time, and that the debugger is adding this data on each hop? However, I can debug all the pieces in the original sample I'm working from with no errors, so I'm not sure I believe the explanation I've seen, or I don't understand something yet. Anyone have an explanation how I can debug mine without getting this exception?
Can you check if your machine config has element. You might need to comment this out. (Before any changes to machine config do back it up)

Classic ASP - Error Catching

I'm working on a site and to help catch errors that we may not hear about, I've created a custom 500 error page.
This page basically records information about the current situation and logs it including the following:
Request.Servervariables("URL")
But, the log seem to actually be providing information about the location of the error.asp file instead of the actual file causing the error. And it doesn't seem to pick up Server.GetLastError().
Any ideas on how to ensure these scripts pick up the errors and deatils about the page causing the error and not the page that is used for 500 errors?
NOTE: When there's an error, the url in the address bar is always the address fo the page causing the error, but the log shows the error handler page 'error.asp'.
I would follow what Dee said, but also be aware that there was something finicky with IIS7 (or 7.5). I can't remember exactly, but you have to do something special to make sure it works on IIS7. Check out this article. IIS7 breaks the server.getlasterror and there is a workaround provided.
Also a cool thing to do is to email yourself those errors. So in your custom 500 asp script just fire off an email with the details. Depends on how critical errors are to your program, but it's good to be in the loop rather than have another log to worry about.

Raising route not found error

I'm writing a book on Rails 3 at the moment and past-me has written in Chapter 3 or so that when a specific feature is run that a routing error is generated. Now, it's unlike me to go writing things that aren't true, so I'm pretty sure this happened once in the past.
I haven't yet been able to duplicate the scenario myself, but I'm pretty confident it's one of the forgotten settings in the environment file.
To duplicate this issue:
Generate a new rails project
important: Remove the public/index.html file
Add cucumber-rails and capybara to the "test" group in your Gemfile
run bundle install
run rails g cucumber:skeleton
Generate a new feature, call it features/creating_projects.feature
Inside this feature put:
This:
Feature: Creating projects
In order to value
As a role
I want feature
Scenario: title
Given I am on the homepage
When you run this feature using bundle exec cucumber features/creating_projects.feature it should fail with a "No route matches /" error, because you didn't define the root route. However, what I and others are seeing is that it doesn't.
Now I've set a setting in test.rb that will get this exception page to show, but I would rather Rails did a hard-raise of the exception so that it showed up in Cucumber as a failing step, like I'm pretty sure it used to, rather than a passing step.
Does anybody know what could have changed since May-ish of last year for Rails to not do this? I'm pretty confident it's some setting in config/environments/test.rb, but for the life of me I cannot figure it out.
After I investigate the Rails source code, it seems like the ActionDispatch::ShowExceptions middleware that responsible of raising exception ActionController::RoutingError is missing in the test environment. Confirmed by running rake middleware and rake middleware RAILS_ENV=test.
You can see that in https://github.com/josh/rack-mount/blob/master/lib/rack/mount/route_set.rb#L152 it's returning X-Cascade => 'pass' header, and it's ActionDispatch::ShowExceptions's responsibility to pick it up (in https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/middleware/show_exceptions.rb#L52)
So the reason you're seeing that your test case is passing because rack-mount is returning "Not Found" text, with status 404.
I'll git blame people and get it fix for you. It's this conditional here: https://github.com/rails/rails/blob/master/railties/lib/rails/application.rb#L159. If the setting is true, the error got translated right but we got error page output. If it's false, then this middleware doesn't get loaded at all. Hold on ...
Update: To clearify the previous block, you're hitting the dead end here. If you're setting action_dispatch.show_exceptions to false, you'll not get that middleware loaded, resulted in the 404 error from rack-mount got rendered. Whereas if you're setting action_dispatch.show_exceptions to true, that middleware will got loaded but it will rescue the error and render a nice "exception" page for you.