Richard, What you want is:
csv_data_dir = RAILS_ROOT + "/public/data/csv" Rick On Nov 22, 3:37 pm, RichardOnRails <[EMAIL PROTECTED]> wrote: > Hi, > > I'm developing a small Rails 2.2.0 app. I have a slightly modified > scaffold-generated file, > PayrollSys\app\controllers\cvs_items_controller.rb, as follows: > > class CvsItemsController < ApplicationController > # GET /cvs_items > # GET /cvs_items.xml > require 'find' # Added > > def index > logger.info "==> index in cvs_items_controller.rb" > # @cvs_items = CvsItem.find(:all) > @cvs_items = get_csv_filenames_attributes() # Replacement > > [snip] > > protected > def reload > logger.info "==> Reload in cvs_items_controller.rb -- RLM " > end > > def get_csv_filenames_attributes # Brand new method > csv_data_dir = "../../public/data/csv" > values = [] > Find.find(csv_data_dir) do |item| > next unless File.file?(item) > values << item > end > values > end > end > > Using a logger, I have confirmed that no filenames have been returned > by File.find and that the values array remains zero length. > > However, the exact same method (without the "def" and its closing > "end"), when added to a brother file in the same directory, correctly > lists the two .csv files in the > PayrollSys\public\data\csv directory (when a puts is prepended to the > closing "values" symbol). > > Is there some security method that precludes accessing the files? > Would the tableless plugin be relevant, though I do want ActiveRecord > to access the application database(s). > > Thanks in Advance, > Richard --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---