Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8369497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:39:37+00:00 2026-06-09T13:39:37+00:00

Model: class Country include DataMapper::Resource property :id, Serial property :name, String property :continent, String

  • 0

Model:

class Country
  include DataMapper::Resource
  property :id, Serial
  property :name, String
  property :continent, String
end

I’m trying to do a query by the name attribute:

Country.find(:name => "value")

But it keeps returning me a nil. Which should not be the case since I’m very sure that the record with the particular value exist in the database.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T13:39:38+00:00Added an answer on June 9, 2026 at 1:39 pm

    I realized I have to do: Country.first(:name => "value") or Country.last(:name => "value")

    Country.get only supports search by primary keys or composite keys

    And alternative is: Country.all(:conditions => { :name => "value" })

    Reference: http://datamapper.org/docs/find.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my model I have class Alias include DataMapper::Resource belongs_to :user property :id, String,
I have a model object called Country : class Country { public string Name
Ok say I have the following model: class Country < ActiveRecord::Base validates_presence_of :name validates_presence_of
I have that situation: I have models Item, Region and Country. class Item(models.Model): name
I have a Java model similar to: public class Country { @Id private String
I have this model: class Location < ActiveRecord::Base acts_as_gmappable def gmaps4rails_address #{self.city}, #{self.country} end
I've defined a class called Country that has a unique name field. class Country(models.Model):
I have this models in Django class Country(models.Model): name = models.CharField(max_length=80) class Person(models.Model): first_name
suppose I have a domain classes: public class Country { string name; IList<Region> regions;
#model class Promotion(models.Model): name = models.CharField(max_length=200) start_date = models.DateTimeField() end_date = models.DateTimeField() #view def

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.