In routes.rb:
resources :conversations, only: [:index, :show, :new, :create, :destroy] do
collection do
get :inbox
end
In my controller:
def inbox
<stuff>
end
In my view (using haml):
=link_to 'Inbox', inbox_conversations, :id => 'load-inbox', :class => 'message-control-highlight', :remote => true
I get the following error on page load:
undefined local variable or method `inbox_conversations' for #<#<Class:0x3d51470>:0x3d59198>
In my view, if I replace inbox_conversations with a “#”, I don’t get any errors on page load. I’ve tried appending inbox_conversation with likely classes, such as current_user and current_user.mailbox. I’ve also tried changing the routing from collection to member–and even taking it out of any collection/member block. What could be the problem here?
Try using
inbox_conversations_pathorinbox_conversations_url=link_to 'Inbox', inbox_conversations_path, :id => 'load-inbox', :class => 'message-control-highlight', :remote => true