0
我一直試圖使用'github_api'寶石來拉入信息。當我在終端中測試所有內容時,我可以將信息保存到我的用戶以及我創建的回購數據庫。然而,我把所有的信息放在我的控制器中,現在我不斷收到一個語法錯誤,意外的tLABEL,期待'='錯誤。以下是我的用戶控制器中的代碼和錯誤圖片。請幫忙!意外的tLABEL,期待'='錯誤
class UsersController < ApplicationController
def index
@users = User.all
end
def create
@user = User.new
(
id: Github.search.users(params[:name]).items[0].id,
username: Github.search.users(params[:name]).items[0].login,
html_url: Github.search.users(params[:name]).items[0].html_url,
avatar_url: Github.search.users(params[:name]).items[0].avatar_url
)
end
if @user.save
Github.repos.list user: params[:name] do |repos|
Repo.create
(
user_id: repos.owner.id,
name: repos.name,
address: repos.full_name
)
end
redirect_to users_path
else
render users_path
end
end
def show
@user = User.find(id: params[:id])
end
末
大聲笑,感謝編輯 – zishe
你們真棒,它的工作! –