0
My Controller:
class RoomsController < ApplicationController
before_action :set_room, only: [:show, :edit, :update, :destroy]
def nome_completo
"#{title}, #{location}"
end
# GET /rooms
# GET /rooms.json
def index
@rooms = Room.all
end
# GET /rooms/1
# GET /rooms/1.json
def show
end
# GET /rooms/new
def new
@room = Room.new
end
# GET /rooms/1/edit
def edit
end
......
end
My View:
<h1>Quartos recém postados</h1>
<ul>
<% @rooms.each do |room| %>
<li><%= link_to room.nome_completo , room %></li>
<% end %>
</ul>
The error shown is: Undefined method `full name' for #Room:0x0000000ed6d478
As you can see, the method is already defined in the controller, and my view can call several methods from the Room controller except those I defined.