Displaying 20 results from an estimated 2000 matches similar to: "Join Tables"
2009 Jul 16
9
Please help me understand how arrays are translated in rails
I''ve spent hours researching the subject and have tried many test
sequences in IRB, and rails console but I''m just having trouble making
headway into what is probably a very easy subject.
I understand arrays with at least 4 other languages but with Ruby I
haven''t found a mental connection with how I can assign variables to
arrays..
Take for example:
def
2009 Jul 17
19
I need help saving table data from a rake task
I need to find out how I can create and save a large dataset to a table
based on multiple returned arrays from a Rake task.
Here is my example using just two arrays (there are 14 in this
particular rake task):
update_tsos_offense = TsosOffense.new
to_team_id, to_ppcs = update_tsos_offense.calculate_tsos(TotalOffense,
"ydspgm", "desc")
ro_team_id, ro_ppcs =
2009 Jun 13
8
Removing routes to new, show, etc. in a model
Example model: demo
--app
----Controllers
------application_controler.rb
------demos_controller.rb
----Models
------demo.rb
----Views
------demos
--------index.html.erb (I want to keep this)
--------edit.html.erb (delete)
--------new.html.erb (delete)
--------show.html.erb (delete)
http://localhost:3000/demos/new (should not be a route)
http://localhost:3000/demos/edit (should not be a route)
2009 Jul 02
7
Params Merge and URL sorting/pagination
Hi all,
Here''s my general setup on the specific template I''m having issues with:
will_paginate for pagination
custom methods for sorting
1-form for team search
1-form for search by date
When searching for a team for instance, the url returned will be:
/rushing_offenses?search=Florida
When searching by date, the url returned will be:
/rushing_offenses?compiled_on=2009-07-02
2009 Jul 09
8
Only One Controller + Urgent
Hi Champs,
Need Help .. :(
Actually the thing is that i am having many controllers a, b, c and d..
But what i want it that only "a" should be displayed to the users .. b,
c, d not ..
Is there any way to do it .. ?
Cheers ..
--
Posted via http://www.ruby-forum.com/.
2009 Jun 07
17
ActiveRecord Classes
I''m having a little trouble with understanding how to work out the
schematic for some of my classes using ActiveRecord when a file is in my
lib directory:
Brief example:
Here''s the outline of the files in use:
....app
........controllers
............application_controller.rb
............rushing_offenses_controller.rb
........models
............rushing_offense.rb
....lib
2009 Jul 07
10
link_to, how do you combine url options and html_options?
I have a link-to that I wish to look somewhat like this:
link_to "link here", new_object_path,
:method => :post, :confirm => ''Press OK'', #url
options
:class => "css_class", :id => "css_id" #html
options
In any case I can either get the url_for options to work or the html
options to work, but
2009 Jul 29
5
[newbie] double relationships in database
I have the following tables
teams
id :string
name :string
and
matches
id:
home_team :team_id
visitor_team :team_id
how can I reflect that kind of relationship in a RoR model?
thanks and keep up the good work.
2006 Jul 26
8
team captain - habtm w/has_one...
the below...
class User < ActiveRecord::Base
has_and_belongs_to_many :teams
class Team < ActiveRecord::Base
has_and_belongs_to_many :users
has_one :captain, :class_name => ''User''
produces the error...
Mysql::Error: Unknown column ''users.team_id'' in ''where clause'': SELECT *
FROM users WHERE (users.team_id = 1) LIMIT 1
i
2006 Apr 03
2
HABTM migrations
Bad rails day for Matt-
In a migration, for a habtm:
create_table :teams_users do |t|
t.column :team_id, :integer
t.column :user_id, :integer
end
Ok, fine. In a controller (well really a migration script):
@user.teams << Team.find( 3 )
And the SQL pumped at my server is:
INSERT INTO teams_users (`team_id`, `id`, `user_id`) VALUES (3, 3, 34)
Which
2008 Jan 27
4
(REST) Nested routes
Hello, I''m in troubles with nested routes. I have three models: Team,
Tournament and TeamTournaments
class Team < ActiveRecord::Base
has_many :tournaments, :through => :team_tournaments
has_many :team_tournaments
class TeamTournament < ActiveRecord::Base
belongs_to :team, :foreign_key => ''team_id''
belongs_to :tournament, :class_name =>
2006 Jan 23
15
Looking for DB/Model Design Suggestions
Hi,
I''m working on an app - my first Rails - and am looking for some
suggestions on the best way (or good way) to set up my models / DB. In
general there are teams and matches; a team will participate in multiple
matches, and in each match there will be 6 teams - 3 vs. 3.
I''m going to want to be able, for a particular team, pull up all matches
for that team, to display a
2006 Jan 31
1
Updating :has_many - :through related items
Hi,
I''ve got my little app working pretty well. I''m using pretty much the
model and table layout from my previous thread, as suggested by Bill
Katz:
<http://www.ruby-forum.com/topic/52506#26260>
I have the Create page working and a delete Match page working, which
along with the appropriate record in the Matches table, removes the
linked items in the competitions table.
2005 Dec 31
6
habtm recursion via destroy_without_callbacks
I am having a problem with two models that each have a HABTM
relationship to the other. For example:
CREATE TABLE people (id INT, name TEXT);
CREATE TABLE teams (id INT, name TEXT);
CREATE TABLE people_teams (person_id INT, team_id INT);
The person model has:
has_and_belongs_to_many :teams
And the team model has:
has_and_belongs_to_many :people
The trouble comes when trying to destroy
2011 Oct 24
2
Syntax Help for xyplot()
Thanks to David's help I subset my large data set and produced a smaller
one for a single stream and 7 factors of interest. The structure of this
data frame is:
str(burns.tds.anal)
'data.frame': 718 obs. of 4 variables:
$ site : Factor w/ 143 levels "BC-0.5","BC-1",..: 1 1 4 6 4 4 4 5 5 5
$ sampdate: Date, format: "1996-06-02"
2006 May 14
3
Strange Database Mapping Question
Dear Rails List,
I am new on the list so will assume straight away that this question has been
answered before. As I can see no immediate way of searching the list, I will
ask the question. I apologize in advance for any disruption this may cause.
Question time:
I am trying to write a web application for the staff at my office to play a
form of virtual Super14. Its a bit like any of the
2008 Nov 10
2
Sort model based on max value of has_many field
Hi,
I have models such as:
class Team < ActiveRecord::Base
has_many :games
end
class Game< ActiveRecord::Base
belongs_to :team
end
So there are many (well, 0 to 6) games for each team. Team game has a
"score". I would like to get a list of the teams, sorted by the highest
scoring game - sort of a ranking based on highest score. I''ve tried
several cominations of
2011 Oct 27
2
Syntax Check: rshape2 melt()
This is my first excursion into using reshape2 and I want to ensure that
the melt() function call is syntactically correct.
The unmodifed data frame is organized this way:
head(tds.anal)
site sampdate param quant
1 UDS-O 2006-12-06 TDS 10800
4 STC-FS 1996-06-14 Cond 280
7 UDS-O 2007-10-04 Mg 1620
9 UDS-O 2007-10-04 SO4 7580
19 JCM-10B 2007-06-21 Ca 79
20
2010 Jan 25
15
database design question: building features
I am trying to decide between two different database architectures for
an application to manage properties. For capturing the property
features, I have two options: a single model/table with all the features
as fields, or a set of joined models - property, feature, feature data.
(see attached ERD diagram)
OPTION A
Properties
name
address
has_pool
has_doorman
has_etc. (a bunch of values, not all
2006 Jun 22
4
Filter on variable
Hi all,
I have a question about filtering on a variable.
If I have the following code in my controller to select a list of
users
> @allusers = User.find(:all,
> :conditions => [''team_id = ?'', @params["id"],
> :order => ''created_at'')
Is there an easy way to find out all users who