eldorado554
2012-May-30 21:44 UTC
create a model/migration from an object that is returned from a gem that i installed
I am using the fog gem.
The fog gem has been added to my Gemfile
I would like to store the Fog object in my own database/model/
migration.
I tried to create the model like so, as I would usually create a
model, but using the Fog data type:
[tago@DevServer my]$ rails generate model fogaws fogobject:Fog
invoke active_record
create db/migrate/20120530114756_create_fogaws.rb
create app/models/fogaws.rb
invoke test_unit
create test/unit/fogaws_test.rb
create test/fixtures/fogaws.yml
However when I try the rake db:migrate I get this show stopper:
== CreateFogaws: migrating
==================================================-- create_table(:fogaws)
rake aborted!
An error has occurred, this and all later migrations canceled:
undefined method `Fog'' for
#<ActiveRecord::ConnectionAdapters::TableDefinition:0x7fb3bc773798>
Here is what a Fog object can look like:
>> server = connection.servers.create
<Fog::Compute::AWS::Server
id="i-0984916f",
ami_launch_index=0,
availability_zone="us-east-1c",
block_device_mapping=[],
client_token=nil,
dns_name=nil,
groups=["default"],
flavor_id="t1.micro",
image_id="ami-3202f25b",
kernel_id="aki-427d952b",
key_name=nil,
created_at=Wed May 30 00:50:41 UTC 2012,
monitoring=false,
placement_group=nil,
platform=nil,
product_codes=[],
private_dns_name=nil,
private_ip_address=nil,
public_ip_address=nil,
ramdisk_id=nil,
reason=nil,
root_device_name=nil,
root_device_type="ebs",
security_group_ids=nil,
state="pending",
state_reason=nil,
subnet_id=nil,
tenancy="default",
tags=nil,
user_data=nil,
vpc_id=nil
>
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2012-May-31 07:46 UTC
Re: create a model/migration from an object that is returned from a gem that i installed
On 30 May 2012 22:44, eldorado554 <pringlesoriginal-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I am using the fog gem. > > The fog gem has been added to my Gemfile > > I would like to store the Fog object in my own database/model/ > migration. > > I tried to create the model like so, as I would usually create a > model, but using the Fog data type: > > > > > [tago@DevServer my]$ rails generate model fogaws fogobject:Fog > invoke active_record > create db/migrate/20120530114756_create_fogaws.rb > create app/models/fogaws.rb > invoke test_unit > create test/unit/fogaws_test.rb > create test/fixtures/fogaws.yml > > > > > However when I try the rake db:migrate I get this show stopper: > > > > > == CreateFogaws: migrating > ==================================================> -- create_table(:fogaws) > rake aborted! > An error has occurred, this and all later migrations canceled: > > undefined method `Fog'' for > #<ActiveRecord::ConnectionAdapters::TableDefinition:0x7fb3bc773798>I don''t know anything about Fog, but if you know what should be in the table schema then you could just write the migration by hand. Colin -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.