0

I'm teaching Rails to general population high school kids. Despite my best efforts, a few kids used a singular controller name. E.g. Model is Car, but then when creating the controller, they also say "Car" instead of "Cars". This seems to create a set of problems (such as model name error, routing errors, etc.). I haven't found a clean, elegant way to deal with this. Current Workarounds: (1) I have them use a completely different model name, such as using "Vehicle" and "Vehicles" for the model and controller names, instead of cars. (2) I have them just start a new project and do it right the 2nd time.

Attempted fixes that failed: (a) Refactoring the bad model name to the correct one: has no apparent effect. (b) Creating a new model "Car2": we see a bunch of things like "car2s" as Rails auto-pluralizes stuff. :)

Other possibly useful clues / comments: (1) We are using RubyMine as our IDE, on Windows boxes. (2) I am a very experienced programmer in general, but only intermediate level or even beginner level Rails programmer.


Edit 6/11/16: So another kid did it, but I caught it early and just did a Refactor + Rename in RubyMine. It renamed the filename, renamed the class name, and renamed the views directory it had created. After that everything worked fine.

  • Is this what you're looking for? [How to rename rails controller and model in a project](http://stackoverflow.com/questions/11924124/how-to-rename-rails-controller-and-model-in-a-project) – Hamms May 31 '16 at 22:25
  • have you tried https://github.com/jcrisp/rails_refactor ? – floum May 31 '16 at 22:32
  • This is a great course with videos explanning the problems your kids are having https://www.codeschool.com/courses/rails-for-zombies-redux it is teached by gregg pollak and it covers the basics of controllers and models – xeitor Jun 02 '16 at 02:19

0 Answers0