Class: ActiveRecord::Generators::MaestranoUserGenerator
Instance Method Summary
collapse
#model_contents, #model_type, #needs_attr_accessible?, #rails_3?, #strong_parameters_enabled?
Instance Method Details
#copy_maestrano_migration ⇒ Object
10
11
12
|
# File 'lib/generators/active_record/maestrano_user_generator.rb', line 10
def copy_maestrano_migration
migration_template "migration.rb", "db/migrate/add_maestrano_to_#{table_name}.rb"
end
|
#inject_maestrano_content ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/generators/active_record/maestrano_user_generator.rb', line 14
def inject_maestrano_content
content = model_contents
class_path = if namespaced?
class_name.to_s.split("::")
else
[class_name]
end
indent_depth = class_path.size - 1
content = content.split("\n").map { |line| " " * indent_depth + line } .join("\n") << "\n"
inject_into_class(model_path, class_path.last, content) if model_exists?
end
|
#migration_data ⇒ Object
29
30
31
32
33
34
35
36
|
# File 'lib/generators/active_record/maestrano_user_generator.rb', line 29
def migration_data
<<RUBY
## User source identification fields
t.string :provider
t.string :uid
t.string :tenant
RUBY
end
|