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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:18:39+00:00 2026-06-08T12:18:39+00:00

Just started playing with Ruby (no IT background) and until now went it quite

  • 0

Just started playing with Ruby (no IT background) and until now went it quite well. But since two days I’m stuck and don’t understand what’s going wrong… so many thanks already for helping me out with this problem!! The situation is as described below:

I created a currencymaster table with the following columns: currmasdesc:string, currmasiso:string.
I created a currencyrate table with the following columns: currratemasteridd:integer, currratemasteridc:integer, currraterate:decimal, currratedate:date. Whereby the column currratemasteridd reflects the Dominant Currency and the currratemasteridc reflects the Converted Currency to generate combined a currency-pair.

The models/currencymaster.rb looks like this:

class Currencymaster < ActiveRecord::Base
  has_many :CurrencyRateDom, :class_name => "Currencyrate", :foreign_key => "CurrRateMasterIDD" 
  has_many :CurrencyRateConv, :class_name => "Currencrate", :foreign_key => "CurrRateMasterIDC"
end

The models/currencyrate.rb looks like this:

class Currencyrate < ActiveRecord::Base
  belongs_to :CurrencyDominant, :class_name => 'Currencymaster' , :foreign_key => "CurrRateMasterIDD", :validate => true
  belongs_to :CurrencyConverted, :class_name => 'Currencymaster' , :foreign_key => "CurrRateMasterIDC", :validate => true
end

The controllers/currencyrates_controller.rb looks like this:

class CurrencyratesController < ApplicationController
  # GET /currencyrates
  # GET /currencyrates.json
  def index
    @currencyrates = Currencyrate.all

    respond_to do |format|
      format.html # index.html.erb
      format.json { render json: @currencyrates }
    end
  end

  # GET /currencyrates/1
  # GET /currencyrates/1.json
  def show
    @currencyrate = Currencyrate.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.json { render json: @currencyrate }
    end
  end
end

Now is my problem that I can’t show, in the view/currencyrates/index.html.erb , the related currencymaster.currmasiso instead of the currratemasteridd & currratemasteridc stored in the table currencyrate.

I hope all information is avaibale in this question, else please let me know when other information is needed. Thanks again!

  • 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-08T12:18:40+00:00Added an answer on June 8, 2026 at 12:18 pm

    Why you don’t follow conventions?

    You should create a CurrencyMaster class, don’t repeat “currmas” or “currrate” in your column’s name. Don’t override foreign keys… You code should be like this :

    class CurrencyMaster < ActiveRecord::Base
      has_many :currency_rate_doms
      has_many :currency_rate_convs
    end
    

    It’s the same in your other classes. Rails use the “convention over configuration principe. It would be better after that.

    Welcome to wonderful ruby/rails world.

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

Sidebar

Related Questions

I've just started playing around in Haskell. After years of Ruby, I got used
I just started playing with Berkeley DB a few days ago so I'm trying
I have just started playing with TeamCity and its great. Now I got it
Just started playing with knockout.Js which is a fantastic framework Steve's really done well
I've just started playing around with box2dweb and have now run into a problem
Just started playing around with ice_cube I've got a weekly schedule (with a granularity
I just started playing around with threading today and I ran into something that
I just started playing around with the 960 CSS framework and found that it
I just started playing with Clojure, and I wrote a small script to help
I just started playing with Linq to entities in a windows forms application and

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.