Last active
December 10, 2015 14:48
-
-
Save amite/4450506 to your computer and use it in GitHub Desktop.
c.profile_datum
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I have a client class | |
```` | |
class Client < ActiveRecord::Base | |
attr_accessible :name, :notetag | |
has_many :profile_datum | |
end | |
```` | |
..and a ProfileDatum class | |
```` | |
class ProfileDatum < ActiveRecord::Base | |
belongs_to :client, :dependent => :delete | |
attr_accessible :address, :emailid, :notes, :phone, :client_id | |
end | |
```` | |
I create objects like so: | |
p1 = ProfileDatum.create(:address => "Mumbai on the manger", :notes => "ever work with him", emailid: "[email protected]", :phone => "3434673453") | |
c = Client.find(2) #this exists | |
And then I try to associate like this: `c << p1` sometimes it works but most times it doesn't. | |
When it works,I try to associate like so: | |
`c.profile_datum` and it doesn't work #undefined method `profile_datum' for #<Array:> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment