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

  • Home
  • SEARCH
  • 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 6188825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:18:10+00:00 2026-05-24T02:18:10+00:00

My application has deals and orders. I’m processing the orders manually by clicking a

  • 0

My application has deals and orders. I’m processing the orders manually by clicking a link my my admin area when viewing the deals.

views/access/deals/index.html.erb

<%= link_to "Process Orders", process_orders_access_deal_path(deal) %>

In my /controllers/access/deals_controller.rb, I have the following method.

def process_orders
    @deal = Deal.find(params[:id])
    @orders = @deal.orders.where("state" == ?, "pending")
    @orders.each do |order|
      order.purchase
    end
 end

My purchase method is not in my deals model, it’s in my orders model because I set it up there before needing to make changes where orders would not be processed immediately.

Purchase method in orders controller.

def purchase
  response = Order.gateway.purchase(order_amount, billing_id, options)
end

Is it possible to access the purchase method in my order.rb model from my /controllers/access/deals_controller.rb and if so how?

  • 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-24T02:18:11+00:00Added an answer on May 24, 2026 at 2:18 am

    Have you tried calling it?

    Controllers and models aren’t linked by some inexplicable magic. You are able to reference any class (i.e. model) from any other class you want (i.e. controller). There is no restriction.

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

Sidebar

Related Questions

My application has deals which have orders. In my admin area I want to
My app has deals where orders are made once a minimum order amount is
I have an application that deals with events. After an event has occurred, I
my application has to deal with calendar information (incl. single occurrence, recurrence, etc.). In
Our application has a service layer and a DAO layer, written as Spring beans.
Our application has many controls that are created dynamically. For example, a navigation pane
My application has a simple data model with 70 read-only records grouped into six
My application has a table that contains snapshot inventory data from each year. For
My application has encountered a problem and needs to close. Of course Microsoft is
Our application has a couple of shell scripts that are called from web-based Oracle

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.