NullVoxPopuli
NullVoxPopuli

Reputation: 65183

RoR: I have two controllers that are fairly similar, and want to superclass / subclass them

But I'm wondering what the naming conventions are for this?

Like.. I have object and template_object

so, naturally, object will be the super class, template_object the subclass.

What are the naming conventions for folders and stuff? object_template_object? idk =\

Just looking for any sort of guidelines to follow, before I just break every standard ever. =\

Upvotes: 0

Views: 62

Answers (2)

Tim Snowhite
Tim Snowhite

Reputation: 3776

The naming conventions only prefix namespaces:

class ApplicationController < ActionController::Base
end #=> url_for(:controller => 'application') == application_url()

class UsersController < ApplicationController
end #=> url_for(:controller => 'users') == users_url()

module ProfileSide
  class SomeController < ApplicationController
  end #=> url_for(:controller => 'profile_side/some_controller') 
      #    == profile_side_some_url() 
  class OtherController < SomeController
  end #=> url_for(:controller => 'profile_side/other_controller')
      #    == profile_side_other_url()
end 

Upvotes: 1

iafonov
iafonov

Reputation: 5192

You already have an example of superclass controller - ApplicationController. There is no convention on its name excerpt it should end with Controller.

Upvotes: 1

Related Questions