What is the Message class!?


#1

Hi, Crew. I’m trying really hard to understand what is happening in the following code from the Learning Rails series on Saving Data:

class MessagesController < ApplicationController
	def index
		@messages = Message.all
	end
  def new
    @message = Message.new
  end
  end

What the blazes is this Message method?! Where is it defined? What does it do? Where did it come from!? I tried to recreate this on making my own version of what we’re doing in the instructions, and I don’t have this Message method. I am told is an uninitializede constant. What am I missing?


#2

Hi @martint92,

The MessagesController class is part of Rails. It was created when we ran rails generate controller Messages earlier in the course. This link may have some helpful information for you: http://guides.rubyonrails.org/action_controller_overview.html


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.