Ruby on Rails
Monday, April 23, 2018
Hello,
Below are my Models and Tables/Migrations and I want Query Code based on them
Model: FinanceFeeCategory
Table: finance_fee_categories
Fields: id,name,batch_id
Model: FinanceFeeParticular
Table: finance_fee_particulars
Fields: id,finance_fee_category_id,student_category_id,admission_no,batch_id, due_date
Model: Batch
Table: batches
Fields: id, name
Relationships:
class FinanceFeeCategory < ActiveRecord::Base
belongs_to :batch
belongs_to :student
#
has_many :fee_particulars, :class_name => "FinanceFeeParticular"
has_many :fee_discounts
has_many :batches,:through=>:category_batches
has_many :category_batches
class FinanceFeeParticular < ActiveRecord::Base
belongs_to :finance_fee_category
belongs_to :student_category
belongs_to :receiver,:polymorphic=>true
belongs_to :batch
has_many :fee_discounts
class Batch < ActiveRecord::Base
belongs_to :course
has_many :students
has_many :fee_category , :class_name => "FinanceFeeCategory"
I am Using Rails 2.3.5 and Ruby 1.8.7
Now I have a Dropdown filled with batches I want to populate another Dropdown with Fee Categories based on the
Batch selected
And then a 3rd dropdown with Particulars based on the Category selected
and the need a Query to get all the Students admission_no
based the Due_date if less the Currenct Date for Each the Particular I select from drop down.
Pls someone help me in this.
Thanks in advance.
-- Below are my Models and Tables/Migrations and I want Query Code based on them
Model: FinanceFeeCategory
Table: finance_fee_categories
Fields: id,name,batch_id
Model: FinanceFeeParticular
Table: finance_fee_particulars
Fields: id,finance_fee_category_id,student_category_id,admission_no,batch_id, due_date
Model: Batch
Table: batches
Fields: id, name
Relationships:
class FinanceFeeCategory < ActiveRecord::Base
belongs_to :batch
belongs_to :student
#
has_many :fee_particulars, :class_name => "FinanceFeeParticular"
has_many :fee_discounts
has_many :batches,:through=>:category_batches
has_many :category_batches
class FinanceFeeParticular < ActiveRecord::Base
belongs_to :finance_fee_category
belongs_to :student_category
belongs_to :receiver,:polymorphic=>true
belongs_to :batch
has_many :fee_discounts
class Batch < ActiveRecord::Base
belongs_to :course
has_many :students
has_many :fee_category , :class_name => "FinanceFeeCategory"
I am Using Rails 2.3.5 and Ruby 1.8.7
Now I have a Dropdown filled with batches I want to populate another Dropdown with Fee Categories based on the
Batch selected
And then a 3rd dropdown with Particulars based on the Category selected
and the need a Query to get all the Students admission_no
based the Due_date if less the Currenct Date for Each the Particular I select from drop down.
Pls someone help me in this.
Thanks in advance.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/5781dc46-d3ce-4994-8e05-74104416746e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment