2017-06-03 74 views
-4

我有一個像控制器中的主題一樣的問題。我有錯誤的期待功能結束。但正如你所看到的,我已經完成了這個功能的每一步。我是RoR的初學者。Ruby on rails:意外的輸入結束,期待keyword_end

class UsersController < ApplicationController 
before_filter :authenticate_user! 

    def show 
    @user = User.find(params[:id]) 
    @user_catalogs = @user.catalogs 
    @hash = Gmaps4rails.build_markers(@user.locations) do |location, marker| 
    marker.lat location.latitude 
    marker.lng location.longitude 
    marker.infowindow location.address 
    end 

    def index 
     @users = User.where.not("id = ?",current_user.id).order("created_at DESC") 
     @conversations = Conversation.involving(current_user).order("created_at DESC") 
    end 
end 

回答

2

您在show方法錯過end。試試這個:

def show 
    @user = User.find(params[:id]) 
    @user_catalogs = @user.catalogs 
    @hash = Gmaps4rails.build_markers(@user.locations) do |location, marker| 
     marker.lat location.latitude 
     marker.lng location.longitude 
     marker.infowindow location.address 
    end 
    end 
+1

AAAAH這是更快,加上一個你的速度;) –

+0

非常感謝你:) –

0

發現

def show 
    @user = User.find(params[:id]) 
    @user_catalogs = @user.catalogs 
    @hash = Gmaps4rails.build_markers(@user.locations) do |location, marker| 
    marker.lat location.latitude 
    marker.lng location.longitude 
    marker.infowindow location.address 
    end <<<<< here! 
    end 
+0

非常感謝你非常:) –

+0

@JakubOstrowski你是歡迎您,請不要忘記只接受一個答案(✓) –

相關問題