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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:35:11+00:00 2026-05-15T06:35:11+00:00

My web app, up until this point, has been fairly straight forward. I have

  • 0

My web app, up until this point, has been fairly straight forward. I have Users, Contacts, Appointments and a few other things to manage. All of these are easy – it’s just one model per section so I just did a scaffold for each, then modified the scaffolded code to fit my need. Pretty easy…

Unfortunately I am having a problem on this next section because I want the ‘Financials’ section of my app to be more in depth than the other sections which I simply scaffolded. For example, when the user clicks the ‘Contacts’ link on the navigation bar, it just shows a list of contacts, pretty straight forward and is in line with the scaffold. However, when the user clicks the ‘Financials’ link on the navigation bar, I want to show the bank accounts on the left of the page and a few of the transactions on the right.

So the financials tab will basically work with data from two models: transactions and bank_accounts. I think I should make the models (transactions & bank_accounts) and then make a controller called Financials, then I can query the models from the Financials controller and display the pages in app/views/financials/

Am I correct in this app layout? I have never worked with more than the basics of scaffolding so I want to ensure I get this right!

Thank you!

  • 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-15T06:35:12+00:00Added an answer on May 15, 2026 at 6:35 am

    If you are comfortable with scaffolding then i would suggest that you generate a scaffold for both

    transactions: script/generate scaffold transaction financial_id:integer ...

    bank_accounts: script/generate scaffold bank_account financial_id:integer ...

    and financials script/generate scaffold financials ...

    In your transactions model, add this:

    class Transaction < ActiveRecord::Base
      belongs_to :financial
    end
    

    In your bank_account model, add this:

    class Bank_account < ActiveRecord::Base
      belongs_to :financial
    end
    

    In your financial model, add this:

    class Financial < ActiveRecord::Base
      has_many :transactions
      has_many :bank_accounts
    end
    

    Now from your financials controller you can use something like this:

    def index
      @financial = Financial.find(params[:id])
    
      #This fetches all bank_accounts related to financial
      @bank_accounts = @financial.bank_accounts
    
      #This fetches all transactions related to financial
      @transactions = @financial.transactions
    end
    

    In your views you can view all the bank accounts belonging to a particular financial by just doing this:

    <% @bank_accounts.each do |bank_account| -%>
       <%=h bank_account.something_here %> <!-- something_here is the column name corresponding to your bank_account table.  -->
       <%=h bank_account.something_here %> <!-- something_here is the column name corresponding to your bank_account table.  -->
       <%=h bank_account.something_here %> <!-- something_here is the column name corresponding to your bank_account table.  -->
       .
       .
       .
    <% end -%>
    

    In your views you can view all the transactions belonging to a particular financial by adding something similar:

    <% @transactions.each do |transaction| -%>
       <%=h transaction.something_here %> <!-- something_here is the column name corresponding to your bank_account table.  -->
       <%=h transaction.something_here %> <!-- something_here is the column name corresponding to your bank_account table.  -->
       <%=h transaction.something_here %> <!-- something_here is the column name corresponding to your bank_account table.  -->
       .
       .
       .
    <% end -%>
    

    Remember, while creating a new transaction/bankaccount use the id belonging to the particular financial. Hope this helps. Cheers! 🙂

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

Sidebar

Related Questions

I have a web app that up until now has been skinned (just basic
My web app has been chugging along just great in Production for years with
I have a web app with Tabs for Messages and Contacts (think gmail). Each
I have a web-app that has a master mysql db and four slave dbs.
I have a home grown web server in my app. This web server spawns
This a bit of strange one.... We have an internal web app that runs
WEB APP not native, no Objective-C This is so simple it hurts. <input type=date
Our iOS app has a Web View that is rendering pages from file: URLs.
We have a desktop app that allows users to fill in a questionnaire. For
We're running an C#.net app with users who might have WinXP or might have

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.