Displaying 5 results from an estimated 5 matches for "division_id".
2006 Jan 09
3
Include with two references of one model of the same table
...d(:all, :include => ["hometeam", "awayteam"])
end
end
Heres a sample of the error...
|PGError: ERROR: table name "matches" specified more than once
: SELECT matches."awayteam_goals" AS t2_r1, matches."season_id" AS t1_r7, teams_seasons."division_id" AS t0_r6, matches."hometeam_goals" AS t2_r2, matches."league_id" AS t1_r8, matches."awayteam_id" AS t2_r3, matches."venue_id" AS t1_r9, matches."hometeam_id" AS t2_r4, matches."matchtime_start" AS t2_r5, matches."id" AS t1_...
2006 Jan 18
3
retrieving value from select
In my view, I have:
<%= select("division_filter", "division_id", Division.find_all.collect
{|p| [ p.division, p.id ] }, { :include_blank => true }) %>
How do I retrieve the division_id in my controller?
--
Posted via http://www.ruby-forum.com/.
2007 Aug 04
1
ActiveRecord gotcha with references?
...elongs_to :designation
end
class Designation < ActiveRecord::Base
end
I do the following at the irb console:
Step 1: Find an employee
>> emp = Employee.find 3
=> #<Employee:0x35a7d34 @attributes={"designation_id"=>"3", "id"=>"3",
"division_id"=>"4"}>
Step 2: Save the designation in a variable des
>> des = emp.designation
=> #<Designation:0x35a49b8 @attributes={"name"=>"Project Manager",
"id"=>"3", "division_id"=>nil}>
>> des
=> #<...
2009 Apr 21
2
validates_uniqueness_of
...e.
def test_create_failure_cycle_unique
begin
num_bins = Bin.count
post :create, {:bin => { :carrier => carriers(:A), :cycle =>
cycles(:one), :name => "701", :start => "1:00", :end => "1:01" }}, {
:user => @user_id, :division => @division_id }
validates_uniqueness_of :cycles
assert_response :redirect
assert_redirected_to :action => ''list''
assert_equal num_bins + 1, Bin.count
rescue exception: NoMethodError
assert_response :error
flash[:notice]="Cycle name not unique."
end...
2006 Jan 24
4
How to filter an activerecord find_all...
I have a nice hierarchical table structure like this:
divisions
has_many groups
groups
belongs_to division
has_many subgroups
subgroups
belongs_to group
has_many units
units
belongs_to subgroup
I have a report which is based on units, but i want to be able to filter
the units by which subgroup, or which group, or which division. I also
want to sort them by division.name,then group.name,