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 3627376
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:52:50+00:00 2026-05-18T23:52:50+00:00

When I try to modify and then save a model using DataMapper I get

  • 0

When I try to modify and then save a model using DataMapper I get a SaveFailure exception but no errors.

Specifically I see this message:
“MonthlyBill#save returned false, MonthlyBill was not saved”

This is the code doing the saving:

post '/monthly_bills' do
  with_authenticated_user do |user|
  description = params[:description]
  expected_amount = params[:expected_amount]
  pay_period = params[:pay_period]

  monthly_bill = MonthlyBill.new(:description=>description, :expected_amount=>expected_amount, :pay_period=>pay_period)
  user.monthly_bills << monthly_bill
  user.save
end

The User model:

class User
  include DataMapper::Resource

  property :id,             Serial
  property :email_address,  String
  property :password,       String

  has n, :monthly_bills
  has 1, :current_pay_period
end

The MonthlyBill model:

class MonthlyBill
  include DataMapper::Resource

  property :id,             Serial
  property :description,    String
  property :expected_amount,Decimal
  property :pay_period,     Integer

  belongs_to :user
end

What is the issue and, more importantly, how can I get DataMapper to tell me more specifically what is wrong?

  • 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-05-18T23:52:51+00:00Added an answer on May 18, 2026 at 11:52 pm

    Hmm – those capitalised properties look worrying to me. I would do…

    has n, :monthly_bills 
    has 1, :current_pay_period #do you really have a CurrentPayPeriod model?!
    

    And then try:

    monthly_bill = MonthlyBill.new(:description=>description,:expected_amount=>expected_amount, :pay_period=>pay_period, :user=>user)
    monthly_bill.save
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This page is using jQuery to modify the links and then perform the page
If i create an image with this method and then try to delete/modify the
Try loading this normal .jpg file in Internet Explorer 6.0. I get an error
Try running this in a .VBS file MsgBox(545.14-544.94) You get a neat little answer
Try as I might I cannot get my head around what the IteratorIterator class
Try to see which cast is faster (not necessary better): new c++ case or
Try as I might, I can't get a JNLP file to run locally (via
This is my first question here, and I will try to follow all the
I am trying to get RPC testing using GWT. I am using the default
When I try and open certain TFS2010 Excel reports I get the following error

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.