Displaying 20 results from an estimated 1000 matches similar to: "Complex Database Associations"
2006 Jul 28
0
i need help migrating an old table
i have this big table that has columns:
partnumber, 1piece-price-break, 10K-piece-price-break, 25k, etc...
i want to split this into two tables:
part_number, id
and
price_break, price, product_id
so that, you know, the price-break columns are not stuck at fixed
values; different parts can have differnt numbers of price-breaks, etc
is there a ruby way to do this?
i have navicat, but i
2006 Mar 14
1
Dynamic Finders with _or_create Don''t Work?
What could cause this?
>> sdfl=PartNumber.find_by_part_number("1111111")
=> #<PartNumber:0xb78fc744 @attributes={"id"=>"11601",
"part_number"=>"1111111"}>
>> sdfl=PartNumber.find_or_create_by_part_number("1111111")
NoMethodError: undefined method `find_or_create_by_part_number'' for
PartNumber:Class
2006 Jan 11
0
Easy Question, I Think
I am just getting started with Rails, don''t know any Ruby, and don''t
quite even get object oriented programming yet. I have tweaked my
schema to The Rails Way and have generated a bit of scaffolding.
I am trying to create a new Part, which references a PartName and a
PartNumber. I can create a PartNumber on the fly, but the PartName
has to exist. I have an inelegant solution
2006 Jan 12
0
Easy Question, I Think [re-post, sorry if dupe]
I am just getting started with Rails, don''t know any Ruby, and don''t
quite even get object oriented programming yet. I have tweaked my
schema to The Rails Way and have generated a bit of scaffolding.
I am trying to create a new Part, which references a PartName and a
PartNumber. I can create a PartNumber on the fly, but the PartName
has to exist. I have an inelegant solution
2006 Jan 13
0
Form element that is not an AR object attribute
Fellow Railers,
I don''t know how to handle this kind of situation the Rails way, please help.
DB
----
create table products (id int not null auto_increment, name
varchar(255), primary key (id));
create table batches (id int not null auto_increment, product_id int
not null, quantity int not null, price decimal(10,2) not null, primary
key (id), foreign key (product_id) references
2011 Dec 13
2
Generating input population for microsimulation
Hi all,
I've been struggling with some code and was wondering if you all could help.
I am trying to generate a theoretical population of P people who are housed within X different units. Each unit follows the same structure- 10 people per unit, 8 of whom are junior and two of whom are senior. I'd like to create a unit ID and a unique identifier for each person (person ID, PID) in the
2006 Jan 15
6
Saving one-many associations (elegant solution please)
What is the most elegant way to save new one-many associations?
order = Order.new(:name => "My Order")
order.line_items << LineItem.new(:product_id => 1, :quantity => 2)
order.line_items << LineItem.new(:product_id => 2, :quantity => 5)
order.save
The above - which is by far the most elegant way of putting it - doesn''t
work for me - the line_items
2013 Jun 10
1
Where Query in SQL
Hey all
I am trying to use where in clause in sql query in R
here is my code:
sql.select<-paste("select PERSON_NAME from UNITS where UNIT_ID in
('",cathree,"')",sep="")
where cathree is 1 variable with 16 observations as follows
UNIT_ID
1 205
2 209
3 213
4 217
5 228
6 232
7 236
8 240
9 245
10 249
11 253
12 257
13 268
14 272
15 276
16 280
but when i run
2006 Jul 11
7
Rails associations: Easy Question requires dumb answer
***Scroll down to see the dumb quick question***
I have two Models:
class Template < ActiveRecord::Base
end
which has this migration:
/snip
t.column :name, :string
And the other model:
class Product < ActiveRecord::Base
has_one :template
end
with the migration:
/snip
t.column :qty, :integer, :default => 0
t.column :specialDescription, :string
t.column
2006 Dec 01
1
group by
Dear R-community,
I started using R to control yield and output from different factories by
production week. A typical example is below.
Location Week ShippedWafer SortedWafer UnsortedWafer
WaferYield GoodDie
A 47 9 4 5 0.476 -12
B 40 5 5 0 -0.3262 -9
B 48 2 1
2006 Jul 20
4
Help with Rails and postgres with sequence numbers (global?)
Hello,
I am building an Rails applications that has to integrate an legacy
system (lxoffice) (schema at:
http://www.lx-office.org/uploads/media/DB_Schema_2.1.1_R_393_17_03_2005_.pdf).
They somehow use global ids (global for some tables). I can not change
the schema and still I want to use Rails to access it and not pure SQL.
When I try to insert a record I get the following message:
2007 May 22
3
can I use acts_as_list with a has_many :through association
I''d like to be able to use a has_many :through association and treat
the associations as a list but I''m getting this error when I try an
use an acts_as_list method:
NoMethodError: undefined method `move_to_bottom''
I''m using edge rails r6786.
Here are my domain rules:
Activities are things students can do.
Units consists of a sequenced list of
2015 Mar 11
0
[PATCH] pmu/gk20a: PMU boot support.
Hi Deepak,
There's... a lot of stuff going on here. Can you describe the goal of
this patch (which could then be used as the patch commit message)? The
current one basically boils down to "Add support for loading PMU", but
merely loading the fw into a fuc engine is just a handful lines of
code. Also, except in rare cases, it's customary to split up patches
of this size into
2006 Mar 10
2
adding to has_many on create and edit
Hello,
I am fairly new to RoR and I have a question I hope can be solved
elegantly (so many things are, so why not this one too?). I have a
working solution, but I want to be sure I am doing things the "rails
way" (having come from PHP). You could say I am looking for a little
validation (no flames please).
I have a table of units like so:
CREATE TABLE `units` (
`id`
2006 Jul 13
1
error_messages_for
I can''t seem to figure out how to validate a few fields some1 please
help me out
model---------
class Record < ActiveRecord::Base
validates_presence_of :sw, :flex
end
controller------------
class RecordController < A;;icationController
def new
@record = Rrecord.new
@product = Product.find(params[''product_id''])
end
def create
2006 May 04
2
Building a FAQ
I''m new in Rails, and I''m building my first application. I''m trying to make
a FAQ for this application, organized by product (questions about each
product) and category (questions of different categories or topics), and
there is something I can''t figure it out how to do.
I have these tables:
create_table "faqs" do |t|
t.column "question",
2008 Dec 13
2
What is "The Rails Way" to do this?
I have a PHP application with the following in one of the "views":
<input type="button" onClick="newAlt()" value=" + "></nobr>
The JavaScript for "newAlt()" is:
// using DOM create new input box for alternate part
function newAlt() {
var html = "<input style=''background-color:#FFFFCC'' ";
html +=
2015 Mar 12
2
[PATCH] pmu/gk20a: PMU boot support.
Hi Mirkin,
Your observations are quiet correct.
After the boot code is submitted successfully, I will submit the code to configure & enable features of PMU.(This will be done by sending cmds to PMU).
Now talking about this patch:
Apart from just the boot code, I have also included some things in this patch that I can remove for now(I will include these things in later digestible chunks):
-
2009 Feb 18
3
wrong number of arguments (1 for 0)
Hello,
I am new to ruby on rails. When I tried to create a session I am
getting an error, ''wrong number of arguments (1 for 0)'', in my
controller.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ArgumentError in CustomerController#add_to_cart
wrong number of arguments (1 for 0)
RAILS_ROOT: /project/bob_shopping
Application Trace | Framework Trace | Full
2008 Jun 04
2
Mock with an attributes that has state
I''m developing a rails application. I have an Order model that has_many
OrderItems.
I mocked the OrderItem model in my Order specs using mock_model. I thought
I should focus my specs on each model and always mock associated models.
In my Order model I need a way to merge OrderItems which have the same cost
and same product_id. That I can spec.
The other thing this merge helper