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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:03:02+00:00 2026-05-29T11:03:02+00:00

Currently i have 2 models. Users and Appbreak. They have associations of Users has

  • 0

Currently i have 2 models. Users and Appbreak.
They have associations of
Users has many appbreak.
Appbreaks belongs to users
In my appbreak controller, there is a approve function which is called when a button from the view page is pressed.

In this function, i will need to update a value in the table of appbreak and a value in users table.
I’m able to update value in appbreak by using the following:

$this->Appbreak->id = $id;
    $this->Appbreak->set('approve', 'Yes');
    $this->Appbreak->save();

However, i’m unable to pull the required data value from users table. <– need to do so as i need to do some calculations before passing back the calculated value.

Am i able to get data from another model using the request method? Or do i need to use the find method? If i use the find method, am i able to update the the values and save it back into 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-05-29T11:03:03+00:00Added an answer on May 29, 2026 at 11:03 am

    Use find() to get your values, and if you need to update the values, use save(). Like so:

    $this->Appbreak->Users->find('first', $params); 
    

    (as described here)

    To save, simply create an array with at least the relevant record id. Include any fields you want to update, and then call the save method on the array like so:

    $data = array('id' => 10, 'title' => 'My new title');
    // This will update Recipe with id 10
    $this->Recipe->save($data);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have two different models: User and Project . The User model has
Currently I have a database of Courses, and it has 6 columns: class Course(models.Model):
In the Rails application I’m currently developing I have many request models. We are
I have two models, users and themes, that I'm currently joining in a HABTM
I have my models & associations currently setup like so: class User < ActiveRecord::Base
I have two models, Users and Groups. Each group can have many users and
I currently have a users table and a posts table. My posts table has
I currently have some models: User, Dealer, Sale and Role. Role has a polymorphic
I have a rails app which currently has 3 models: Post , User and
I currently have a site which hosts apps and has a database of users.

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.