5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/sarawong/builder.rb', line 5
def self.form(db, columnNames)
puts 'in builder form'
form = '<form action="/' + db.to_s.downcase + 's" method="post">'
columnNames.each do |column|
if column == 'id' || column == 'created_at' || column == 'updated_at'
puts column
elsif column[-3..-1] == '_id'
puts 'found an _id column'
else
form = form + '<label>' + column.titleize + '</label><input type="text" name="'+column+'">'
end
end
form += '<input id="authenticity_token" name="authenticity_token" type="hidden" value="<%= form_authenticity_token %>"><input type="submit" value="Submit"></form>'
return form
end
|