app/controllers/templates/templates_controller.rb in templates-0.1.0 vs app/controllers/templates/templates_controller.rb in templates-0.2.0
- old
+ new
@@ -4,15 +4,19 @@
def index
render :json => collect_templates
end
+ def mtime
+ render :text => last_modify
+ end
+
protected
def collect_templates
- app_templates = {}
+ app_templates = { :mtime => last_modify }
Dir.new("#{RAILS_ROOT}/app/controllers").entries.each do |controller_file_name|
if controller_file_name =~ /_controller/
controller_name = controller_file_name.camelize.gsub('.rb', '')
@@ -52,9 +56,13 @@
end
end
end
app_templates
+ end
+
+ def last_modify
+ `stat -f %m $(ls -t $(find #{Rails.root}/app/ -type f) | head -n 1)`.strip
end
end
end