Displaying 20 results from an estimated 10000 matches similar to: "table relationships"
2006 Jul 14
20
Method for associated relationships
I have these tables set up like this:
listings has_many :states
<field>state_id [int]
<other fields....
..............
.............>
states belongs_to: listings
<field>name
<other fields..
...............
.................>
In my view I have <%= listing.name %>
have also tried listing.state_id.name , that didn''t seem to do the magic
either.
This
2006 Jun 14
13
Undefined method
I really hope this is not a bad question (as in he''s abusing the
list). However I could use a little direction (even though I''m
reading books, tutorials)
Right now I''m getting a
undefined method `category'' for 4:Fixnum
The specific lines from the rhtml file are:
<td><%= link_to position.category_id.category, :action => "show", :id
=>
2006 Jun 12
3
Syntax errors on "insert into"
I''m digging around and googling but can''t seem to find what I think is a
simple thing. All I''m trying to do is insert data in a migration into a
table, using regular SQL statements.
LIke this:
class AddStateData < ActiveRecord::Migration
def self.up
INSERT INTO states values ('''',''Alaska'');
INSERT INTO states values
2006 Jun 13
8
Joins or relationships ?
I have a table called Post (not the actual name) where users input various
piece of information, Most of the input is done by dynamic select''s (drop
downs).
As an example:
User would choose
Field: Input: Values that go into
Post table
Category Full Time 2
Length 45 Days 4
State
2006 Jun 17
4
Simple tutorial weirdness
Sorry - working on a simple tutorial but something is throwing me
here. I''m supposed to get a Time.now() print to the page but it''s not
working and I can''t figure out why.
No errors are thrown my the page shows:
Howdy, world! My name is Stuart Felenstein.
This was verified at .
So no time stamp showing. I went into IRB , did a Time.now() and it''s
working
2006 Aug 07
8
Login form question
I''m using Rails Recipes to create a login form but instead of username
and password, my setup is firstname, lastname, password.
I seemed to be gramatically challenged and not sure how to set up the
parameter list. Can anyone offer up a suggestion.
The book shows the method starting like:
if request.post?
user = User.find(:first, :conditions => [''username = ?'' ,
2012 Jan 27
3
How to test the model dependence ?
Good morning,
I''m new to rails and am having some basic questions in development. See
if anyone can help me with a test problem. I need to test if my model
"Procedure" is linked to the workflow. If not, the system must
acknowledge an error. Below is the code that is in the file test \ unit
\ procedure_test.rb.
require ''test_helper''
class ProcedureTest <
2006 Jul 16
3
OT: Radrails
Sorry, but I have tried signing up for the RadRails list and never can
get a confirmation email. I think it may not exist.
Anyway, I created a project using just cli, now I''m trying to import
the project with no success. I choose the directory and radrails just
sits there not enabling the okay button
Sound familiar ? Maybe I''m doing something wrong.
Stuart
2006 Aug 08
11
Newb question- method not working
I know this shouldn''t be in the view but to test the code it is.
Anyway if I do just session[user] I get back the user id (the id from
the user table)
which is good.
However this code does not work.
<% a = session[:user] %>
<% uname = User.find(:first, :conditions => id = a) %>
<%= @uname %>
TIA
Stuart
2006 Mar 16
4
Table Relationships Problems.
I have the following tables setup:
locations
:id
:name
systemmessages
:id
:name
systemmessage_validtimes
:id
:name
:systemmessage_id
:location_id
:start
:end
The systemmessage_validtimes has a ''has_many'' relationship with
systemmessages, meaning that there could be many valid times for each
system message.
@systemMessage = Systemmessage.find(1)
E.g. I
2006 Nov 13
9
Setting up Mongrel and Apache , some direction needed
I have a site that is PHP on Apache / RedHat , but will send requests to a
subdomain (running Rails) for database operations.
I believe the set up should be to have ROR using Mongrel, and an Apache
virtual host passing requests from apache to mongrel.
Does this sound correct ?
I believe the Virtual Host is set up in Apache.
One of my problems is I can''t find the httpd.conf file for
2006 Jun 06
1
Please Help with single table inheritance relationships
I''ve been searching the web, wikis, and more, and I haven''t turned up
examples of how to have multiple entities in a single-table inheritance
related to anything.
I have an addresses table, but multiple entities can have Addresses:
both Person (which has 2 addresses) and Retailer. I''ve been told that I
need to use single-table inheritance, and this was my attempt:
2006 Jun 19
12
AWDWR- Question
I''m having a particularly difficult time undersanding one lesson from
this book. This is in relation ot how one would grab "search"
parameters from web forms to search for records in the database. I
understand the :conditions part of find() but am confused on the code:
1- name = params[:name]
pos = Order.find(:all,
:conditions => ["name = ? and pay_type =
2007 Jan 19
0
Do transactions fail with polymorphic has_one relationships?
I have an AR::Base descendant with a complex object graph beneath it,
like so:
ArtisanQuoteInput has_one QuoteInput and then QuoteInput has several
objects attached to it. Note that the relationship between
ArtisanQuoteInput and QuoteInput is polymorphic, so the relationship in
A is written
has_one :quote_input, :as => :program_quote_input
If @artisan_quote_input is an instance of
2006 Jun 09
18
Is IRB the ruby console ?
I''m running script/console but keep getting the message that irb.bat is not
recognized as an internal or external command, operable program or batch
file.
If it means anything I am running instant rails. I can invoke irb straight
forward.
TIA
Stuart
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2006 Jul 15
2
Migrations question
I started working on an app. It''s new at this point so backing up
wouldn''t be difficult, however I''m wondering if there is some plugin
that exists where I can use it to grab the current database (set up
without migrations) and create a migration file ?
Sort of grab a current snapshot of the database and use that as a
stating point for my migrations directory.
TIA
Stuart
2006 Sep 15
7
OT: TinyMCE in Rails
I''m having a problem getting the text area the size I want it to be.
In my view at the top I have this init calls
<script type="text/javascript" >
tinyMCE.init({
mode: "textareas",
theme: ''advanced'',
theme_advanced_toolbar_location: ''top''
});
</script>
Then in my form:
<%= text_area
2006 Jun 03
8
confused about ActiveRecord relationships
I am very confused about where to put the belongs_to and the has_one
(and other relationship identifiers). I have read the RDoc and the
agile book many times about this and I think i still see it backwards.
Let me outline my app so you have an understanding...
I have 2 tables:
Schools { id, school_name, address_id }
and
Addresses { street1, street2, city, state, zip, country }
*** this
2006 Aug 16
0
2 models with multiple relationships
I am in the middle of building YARELS (Yet Another Real Estate Listing
Site), and here is one of my issues with model relationships.
I have to core models and DB tables:
User
Property
Here are the relationships I need to express:
A user can have many properties that he owns (he is the seller)
A user can have many properties on his favorites list (he is a
buyer/seeker)
A user can have many
2006 Jun 13
2
Migration or model first
I sort of asked this the other day but with no replies. I''m new to rails
btw.
Question: Is there a preferred way to create migrations ? What I''ve noticed
is if I create a model first , it sets up the skelton of the migration.
If I create a migration file and then do the model it attempt to create a
migration file and not overide the one already in place. It seems to make
sense