Tell me more ×
Code Review Stack Exchange is a question and answer site for peer programmer code reviews. It's 100% free, no registration required.

I'm trying to set up single table inheritance in Rails. I have single table called Finances, with a type set to Income or Expense.

My code is here: https://gist.github.com/caser85/5096447

Ok, I got it to work! Please review my code. Is it ok to set the type using this method?

@finance.type = params[:finance_type]
share|improve this question
1  
Per the FAQ, if you want your code reviewed, you need to include it directly into your question, not just link to it. – svick Mar 6 at 22:49

closed as off topic by palacsint, Jeff Vanzella, svick, Brian Reichle, Glenn Rogers Mar 8 at 22:10

Questions on Code Review Stack Exchange are expected to relate to code review request within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

1 Answer

You mixing things into FinancesController. The index is for @finances, but new and create is for @income. And there is no such resource in routes.rb, that's why you receiving this error.

share|improve this answer
Denis - thanks for taking a look. I've updated the gist and am now trying to use one form to select the type. I can't get it working but believe I am getting closer. Can you look at the code again? – caseym Mar 6 at 7:06
Ok I got it working but am curious if if there is something I can improve. – caseym Mar 6 at 7:16
It is hard to say. The error in question is fixed, so this is probably should be another question. – denis.peplin Mar 6 at 8:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.