Displaying 20 results from an estimated 214 matches for "file_name".
2006 Jan 05
4
testing file uploads
Hi all,
I was wondering about the class used when rails receives file uploads.
Sometimes it appears to be a File, and other times it is a StringIO.
Also it has methods such as original_filename that don''t appear to
belong to either of these classes. I ask because I''m trying to work out
how to test my fil upload related models and controllers.
Is there some standardised way of
2007 Apr 05
5
Odd error handling in ActionView#compile_template causes WSOD
...ing
''end'' statement), I''m experiencing WSODs - the browser reports a lost
network connection, rather than the helpful compilation error that we
used to have.
When the compilation fails, ActionView#compile_template raises this
error :
TemplateError.new(find_base_path_for(file_name || template), file_name
|| template, @assigns, template, e)
...which appears to have a few things wrong with it.
First off, file_name is always absolute here - eg /Users/jon/
Developer/Stacker/app/views/kittens/index.rhtml. find_base_path_for
is going to fail since it tries to append that path...
2015 Oct 01
1
doveadm + ldap userdb
...[ { "address": 139954408369259
, "build_id": "62d54c5834c6675c5ec229927d4c087a3277c1d2"
, "build_id_offset": 23659
, "function_name": "ldap_input"
, "file_name":
"/usr/lib64/dovecot/auth/libauthdb_ldap.so"
}
, { "address": 139954486291015
, "build_id": "9ab58d2125033b7eef9f04560a7d7d28737585ce"
, "build_id_offset": 502343...
2006 May 23
6
How to list all models of an application?!?
How can I get a list of all model classes in the domain of a Rails
application (all models, both in "app/models" and in
components/somedir/model.rb)?
Thanx in advance for your precious help!
Edoardo "Dado" Marcora
2012 Sep 23
1
ruby koans don't understand the principle sandwhich code
hello,
Im still working on ruby koans.
Now I have to do some sandwhich code.
The exercise looks like this :
require File.expand_path(File.dirname(__FILE__) + ''/edgecase'')
class AboutSandwichCode < EdgeCase::Koan
def count_lines(file_name)
file = open(file_name)
count = 0
while line = file.gets
count += 1
end
count
ensure
file.close if file
end
def test_counting_lines
assert_equal 4, count_lines("example_file.txt")
end
# ---------------------------------------------------------...
2007 Dec 30
6
Restful-Authentication Rspec Failure Rails 2.0.2
I am trying the Restful-Authentication (latest version, downloaded
today) and upon running the generator, doing the migration, prepping
the test system and putting the resources in routes.rb I get a Rspec
test failure:
''SessionsController logins and redirects'' FAILED
expected not nil, got nil
routes.rb has:
map.resources :users
map.resources :sessions
nothing else was
2006 Feb 21
5
how to include an html file?
I have a bunch of html files with partial page content. I''d like to be
able to include the content of these files in my RoR views without
having to change or rename them.
In PHP I''d simply use
include("file.html");
What is the RoR equivalent of this? render_file insists on it being an
rhtml template, and render_partial requires me to rename the file.
Ideally, I
2007 Aug 08
12
Some more win32-changenotify analysis
...In most cases, it didn''t pick up *any* events!
The C extension did much better, though the behavior was somewhat odd.
Most of the time it picked up multiple notifications on some files,
while missing others entirely:
[#<struct Struct::ChangeNotifyStruct action="modified",
file_name="test1\\test2\\File_0">]
[#<struct Struct::ChangeNotifyStruct action="modified",
file_name="test1\\test2\\File_4">]
[#<struct Struct::ChangeNotifyStruct action="modified",
file_name="test1\\test2\\File_4">]
[#<struct Struct::Chan...
2013 Oct 15
4
[Bug 70511] New: nouveau_bo_name_get segmentation fault while running root tutorials/gl/glbox.C
...t;:
[ { "address": 232268192281
, "build_id": "f47cec2a689de012d8eba76ae17ea0996aea03f2"
, "build_id_offset": 219673
, "function_name": "raise"
, "file_name": "/lib64/libc.so.6"
, "fingerprint": "f33186a4c862fb0751bca60701f553b829210477"
}
, { "address": 232268198184
, "build_id": "f47cec2a689de012d8eba76ae17ea0996aea03f2"...
2006 Jan 19
4
UserEngine - rake bootstrap aborted => undefined method `synchronize_with_controllers'' for Permission:Class
...for Permission:Class
My environment is
Rails 1.0.0
Ruby 1.8.2
WinXP
WebBRICK
MySQL 4.1.14
I found the following in a thread about making changes to the
user_engine/app/models/permission.rb and have done this:
BEFORE CHANGE:
# we need to load all the controllers...
controller_files.each do |file_name|
require file_name #if /_controller.rb$/ =~ file_name
end
AFTER CHANGE:
# we need to load all the controllers...
controller_files.sort.each do |file_name|
require file_name #if /_controller.rb$/ =~ file_name
end
I also made the change in the KNOWN ISSUES page of...
2007 Aug 18
1
problem with file_column url generator
...like to act on the model element.
I checked the source code to url_for_file_column, and the problem is
with instance_variable_get().
I have no idea wat is going on! Any help is appreciated. Gordon.
----------------
<% @lst.each do |hwk| %>
<p>
<%= link_to File.basename(hwk.file_name), url_for_file_column(hwk,
"file_name") %>
</p>
<% end %>
---------------------
The File.basename(xxx) prints properly. However, I get the following
message for url_for_file_column:
------------------------------
4: <%# for hwk in @list %>
5: <% @lst.each do |h...
2005 Feb 08
2
test_process.rb => LoadError
Line 4 and following of test_process.rb reads:
if defined?(RAILS_ROOT)
# Temporary hack for getting functional tests in Rails running under
1.8.2
class Object #:nodoc:
alias_method :require_without_load_path_reloading, :require
def require(file_name)
begin
require_without_load_path_reloading(file_name)
rescue Object => e
ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if
File.directory?(dir) }
require_without_load_path_reloading(file_name)
end
end
end
end
Can we change the rescue l...
2006 Apr 10
3
autocomplete 2nd field based on 1st field''s input
I''m trying to populate a field named "file_name" based on the input of a
field named "title". So, for instance, based on the following input in
the "title" field:
My Title Is Awesome
I would want the following "file_name" to be autocompeted on the fly:
My_Title_Is_Awesome
I''ve been going over all...
2010 Aug 08
2
paperclip save to disk and s3
I have a standard Paperclip setup that saves a file to my disk. In
addition I would also like the file saved to my amazon s3 bucket.
[code]
after_save :copy_to_s3
def copy_to_s3
has_attached_file :photo,
:storage => :s3,
:s3_credentials => "#{RAILS_ROOT}/config/s3.yml",
:styles => {
:thumb => "100x100#",
:small => "750x750>"
2006 Jun 20
2
Problem with "can''t dump anonymous class Class"
...exists?(self.file_path)
File.delete(self.file_path)
end
end
def file=(uploaded_file)
@uploaded_file = uploaded_file
self.file_path = sanitize_filename(@uploaded_file.original_filename)
self.content_type = @uploaded_file.content_type
end
private
def new_filename(file_name)
idx = file_name.rindex "."
self.name.gsub(/[^\w\.\_]/, ''_'') + file_name[idx, file_name.length -
idx]
end
def sanitize_filename(file_name)
File.expand_path("#{RAILS_ROOT}/public/documents/#{new_filename(file_name)}"
)
end
end
class Global...
2011 Nov 12
2
dev.new() within a loop
...t-20111111_data/"
basedir <- "/Users/bravegag/code/asl11/data/nclients_2_128-20111110_data/"
pattern <- paste("logs.*cl\\-.*mw\\-.*db\\-.*\\-client\\.dat",sep="")
all_files <- dir(path=basedir, pattern=pattern)
throughput <- NULL
response <- NULL
#file_name <- all_files[1]
# iterate all files
for (file_name in all_files) {
print(paste("processing", file_name, "..."))
df <- read.table(paste(basedir, file_name, sep="")) # read the data as a data frame
names(df)[names(df)=="V1"] <- "...
2012 Sep 26
1
Ask for help - how to change WHIRR.117.csv to WHIRR_117.csv
Hi,
I have a script below.
dat <- read.table(file="pt.csv", header=T, sep=",", row.names=1,
col.names=1)
dat
for(which_col in seq_len(ncol(dat)))
{
subset_data <- dat[,which_col:ncol(dat)]
file_name <- sprintf('%s.csv', colnames(dat)[which_col])
write.csv(subset_data, file_name)
message(sprintf('Saving %s', file_name))
}
dput(head(dat))
structure(list(WHIRR.25 = c(0L, 0L, 0L, 0L, 0L, 0L), WHIRR.28 = c(0L,
0L, 1L, 0L, 0L, 0L), WHIRR.55 = c(0L, 0L, 0L, 0L, 0L, 0L...
2006 Nov 23
0
Two repeatable crash bugs in Ferret proper
Hi guys! Been reading this list for a while.
I have two repeatable Ferret crash bugs, both seg faults.
1. The first bug appears to seg fault Ferret when you use quotes in a search
argument (eg ''file_name:"file name"'')
2. The second bug appears to seg fault Ferret when you attempt to index text
with very long tokens (above 256 chars). It may have something to do with
URL characters and the default analyzer, since other very long tokens parse
successfully.
The code and my system...
2024 Apr 08
4
Exceptional slowness with read.csv
...some of the records have errors - unmatched quotes, specifically.?
Reading the file with readLines and parsing the lines with read.csv(text
= ...) is really slow. I know that the first 2459465 records are good.
So I try this:
> startTime <- Sys.time()
> first_records <- read.csv(file_name, nrows = 2459465)
> endTime <- Sys.time()
> cat("elapsed time = ", endTime - startTime, "\n")
elapsed time = ? 24.12598
> startTime <- Sys.time()
> second_records <- read.csv(file_name, skip = 2459465, nrows = 5)
> endTime <- Sys.time()
> ca...
2006 May 01
2
how to reference a file for download
I have an app that uploads files into the directory RAILS_ROOT/documents/
I tried to access the file for downloading using <a
href="#{RAILS_ROOT}/documents/file_name">my file</a>.
Rails prepends the controller name to the link so I get
<a href="
http://localhost:3000/tasks/show_document/config/.../documents/file_name"
What''s the right way to do this?
thanks.
-------------- next part --------------
An HTML attachment was s...