Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1 from maratgaliev/rails_3.2_compat

Rails 3.2 compat
  • Loading branch information...
commit 8cee310dec272f5f79f34abd14e2a9254b106b1b 2 parents 2767727 + 0db4368
@yaroslav yaroslav authored
View
2  README.md
@@ -18,7 +18,7 @@ Installation
* Add devise_autosigninable to Gemfile:
- `gem 'devise_autosigininable', '1.0.0'`
+ `gem 'devise_autosigninable', '1.0.0'`
* Add :autosigninable to your Devise modules in model, for example:
View
7 generators/devise_autosigninable/devise_autosigninable_generator.rb
@@ -1,7 +0,0 @@
-class DeviseAutosigninableGenerator < Rails::Generator::NamedBase
- def manifest
- record do |m|
- m.migration_template 'migration.rb', 'db/migrate', :migration_file_name => "add_autosigninable_to_#{table_name}"
- end
- end
-end
View
2  lib/devise_autosigninable/schema.rb
@@ -2,6 +2,6 @@
# add to migration neccessary fields for autosignin
def autosigninable
- apply_schema :autosignin_token, String, :limit=>40
+ apply_devise_schema :autosignin_token, String, :limit => 40
end
end
View
0  generators/devise_autosigninable/USAGE → lib/generators/devise_autosigninable/USAGE
File renamed without changes
View
24 lib/generators/devise_autosigninable/devise_autosigninable_generator.rb
@@ -0,0 +1,24 @@
+require 'rails/generators'
+require 'rails/generators/migration'
+
+class DeviseAutosigninableGenerator < Rails::Generators::NamedBase
+
+ source_root File.expand_path('../templates', __FILE__)
+
+ include Rails::Generators::Migration
+
+ def self.next_migration_number(dirname)
+ if ActiveRecord::Base.timestamped_migrations
+ migration_number = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
+ migration_number += 1
+ migration_number.to_s
+ else
+ "%.3d" % (current_migration_number(dirname) + 1)
+ end
+ end
+
+ def copy_migration
+ migration_template 'migration.rb', "db/migrate/add_autosigninable_to_#{table_name}"
+ end
+
+end
View
0  ...tors/devise_autosigninable/templates/migration.rb → ...tors/devise_autosigninable/templates/migration.rb
File renamed without changes
Please sign in to comment.
Something went wrong with that request. Please try again.