Routing error? maybe

I keep getting this error when trying to view my channels controller.

uninitialized constant Channel::MessagesChannel

I'm gonna guess its a routing error but I have no idea how to fix it.

class Message < ActiveRecord::Base
  has_many :messages_channel , :dependent => :destroy
  has_many :channels, :through => :mesages_channels

  #joins between users and messages
  has_many :user_messages
  has_many :users, :through => :user_messages
end

.

class Channel < ActiveRecord::Base
  has_many :messages_channels , :dependent => :destroy
  has_many :messages ,:through => :messages_channels
  has_many :channel_mods , :dependent => :destroy
  has_many :moderators , :class_name =>"User", :through => :channel_mods
  has_many :users_channels , :dependent => :destroy
  has_many :users, :through => :users_channels

end

.

class MessagesChannels < ActiveRecord::Base
  belongs_to :message
  belongs_to :channel
end

.

SeniorProject::Application.routes.draw do

  resources :users 

  resources :channels do
    resources :messages
  end

  resources :users, :user_sessions
  match 'login' => 'user_sessions#new', :as => :login
  match 'logout' => 'user_sessions#destroy', :as => :logout
  match ':controller(/:action(/:id(.:format)))'
  #match 'subscribe' =>'channels#subscribe', :as => :subscribe

  match 'subscribe/:channel_id/:user_id' =>'channels#subscribe', :as => :subscribe

  root :to => 'channels#index', :as => :listchannels



end

Answers


The model MessagesChannels shouldn't be plural, but singular.


Need Your Help

How can i get last 7 days in an array from current date?

objective-c ios4

I want last 7 days (e.g. FRI,THU,WED,TUE,MON,SUN,SAT,FRI) in an array from current date of the system.If someone has any idea please help.Help would be appreciated.Thank you very much.

AngularJS : How to access scope from ui-grid cell template?

javascript angularjs angular-ui-grid

How does one access $scope from a ui-grid cell template? Here's my controller code:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.