i have problem with this AS I AM NOT ABLE TO CALL PROFILE FROM USER IT
SHOWS UNDEFINED METHOD PROFILE.....

class User
include MongoMapper::Document
one :person, :class_name => 'Person', :foreign_key => :owner_id
end

class Person
include MongoMapper::Document
include ROXML

xml_accessor :_id
xml_accessor :email
xml_accessor :url
xml_accessor :profile, :as => Profile


key :email, String, :unique => true
key :url, String
key :owner_id, ObjectId

belongs_to :owner, :class_name => 'User'
one :profile, :class_name => 'Profile'
end

class Profile
include MongoMapper::EmbeddedDocument
include ROXML

xml_reader :person_id
xml_accessor :first_name
xml_accessor :last_name
xml_accessor :image_url


key :first_name, String
key :last_name, String
key :image_url, String
end

--
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@googlegroups.com.
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.

Search Discussions

  • Colin Law at Dec 4, 2011 at 5:43 pm

    On 4 December 2011 17:26, rahul chandra wrote:
    i have problem with this AS I AM NOT ABLE TO CALL PROFILE FROM USER IT
    SHOWS UNDEFINED METHOD PROFILE.....

    class User
    include MongoMapper::Document
    one :person, :class_name => 'Person', :foreign_key => :owner_id
    end

    class Person
    include MongoMapper::Document
    include ROXML

    xml_accessor :_id
    xml_accessor :email
    xml_accessor :url
    xml_accessor :profile, :as => Profile


    key :email, String, :unique => true
    key :url, String
    key :owner_id, ObjectId

    belongs_to :owner, :class_name => 'User'
    one :profile, :class_name => 'Profile'
    That line looks a bit odd

    Colin
    end

    class Profile
    include MongoMapper::EmbeddedDocument
    include ROXML

    xml_reader :person_id
    xml_accessor :first_name
    xml_accessor :last_name
    xml_accessor :image_url


    key :first_name, String
    key :last_name, String
    key :image_url, String
    end

    --
    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@googlegroups.com.
    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.


    --
    gplus.to/clanlaw

    --
    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@googlegroups.com.
    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.
  • Frederick Cheung at Dec 4, 2011 at 8:15 pm

    On Dec 4, 5:26 pm, rahul chandra wrote:
    i have problem with this AS I AM NOT ABLE TO CALL PROFILE FROM USER IT
    SHOWS UNDEFINED METHOD PROFILE.....

    class User
    include MongoMapper::Document
    one :person, :class_name => 'Person', :foreign_key => :owner_id
    end
    As you've written this I wouldn't expect to be able to do
    some_user.profile - you've only defined a person relationship

    Fred
    class Person
    include MongoMapper::Document
    include ROXML

    xml_accessor :_id
    xml_accessor :email
    xml_accessor :url
    xml_accessor :profile, :as => Profile

    key :email, String, :unique => true
    key :url, String
    key :owner_id, ObjectId

    belongs_to :owner, :class_name => 'User'
    one :profile, :class_name => 'Profile'
    end

    class Profile
    include MongoMapper::EmbeddedDocument
    include ROXML

    xml_reader :person_id
    xml_accessor :first_name
    xml_accessor :last_name
    xml_accessor :image_url

    key :first_name, String
    key :last_name, String
    key :image_url, String
    end
    --
    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@googlegroups.com.
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedDec 4, '11 at 5:26p
activeDec 4, '11 at 8:15p
posts3
users3
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2021 Grokbase