Skip to content

Commit

Permalink
Use absolute path in require and catch nil file_name in writer
Browse files Browse the repository at this point in the history
  • Loading branch information
rzane committed Jan 25, 2014
1 parent 9727359 commit d6890fa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/lol_dba/migration.rb
Expand Up @@ -4,7 +4,7 @@ class Migration

def initialize(migration_file)
self.full_name = File.basename(migration_file, ".rb")
require Rails.root + "db/migrate/#{full_name}.rb"
require Rails.root.join(migration_file)
end

def number
Expand Down
1 change: 1 addition & 0 deletions lib/lol_dba/writer.rb
Expand Up @@ -17,6 +17,7 @@ def path
end

def write(string)
return if file_name.nil?
File.open(path, 'a') { |file| file << string; file << ";\n" }
end
end
Expand Down

0 comments on commit d6890fa

Please sign in to comment.