Hi,.
I’m trying to parse a users commit message to the inbuilt grit grit
method ‘repo.commit_all’.
The trouble is I can’t figure out how to do it. The code below runs
without throwing exceptions, but when I look in the git log my files
have not been committed. They have however been uploaded successfully to
the directory.
I’m pretty new to this, so any help, advice or pointers to good grit
tutorials would be great
Code that does not commit the files:
class UploadController < ApplicationController
require ‘grit’
include Grit
def index
#Renders a fiew for the user.
render ‘upload.rhtml’
end
def create
repo =
Grit::Repo.new("/home/resource_portal/website/public/data/upload")
#posts to the data model.
post = DataFile.save(params[:upload])
puts “file uploaded”
render ‘upload’
post = repo.commit_all(params[:message])
end
end
Code that commits the files but does not add the users commit message:
class UploadController < ApplicationController
require ‘grit’
include Grit
def index
#Renders a fiew for the user.
render ‘upload.rhtml’
end
def create
repo =
Grit::Repo.new("/home/resource_portal/website/public/data/upload")
#posts to the data model.
post = DataFile.save(params[:upload])
puts “file uploaded”
render ‘upload’
repo.commit_all(:message)
end
end