similar to: set forign key

Displaying 20 results from an estimated 3000 matches similar to: "set forign key"

2006 May 09
7
going crazy!!!!!! ActiveRecord::StatementInvalid in Project
any suggestions on why I am gaining this error. ActiveRecord::StatementInvalid in ProjectsController#create Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' , , , , )'' at line 1: INSERT INTO projects (`name`, `date_created`, `quote_id`, `client_id`, `description`, `user_id`)
2006 Jun 01
4
can''t convert Fixnum into String ??
I have been getting this error message on various pages, just wondering if anyone could explain whats going wrong, and the best way to correct it code that is cuasing the problem is below @project = Project.find(:first, :conditions => "id = " + @purchaseorder.project_id) -- Posted via http://www.ruby-forum.com/.
2006 Apr 20
5
strange mysql problem
i have this model: class LineItem < ActiveRecord::Base belongs_to :quote end in the console: >>l = LineItem.create ActiveRecord::StatementInvalid: Mysql::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' , , , )'' at line 1: INSERT INTO line_items (`qty`, `quote_id`,
2006 Jan 20
11
HABTM relations
Hi, I have 3 tables with HABTM relation. USERS -> QUOTE_TO_USER <- QUOTES Table QUOTE_TO_USER has 3 attributes: quote_id, user_id, component. I have a form where I can tie multiple users to QUOTE. This is easy one, thru "user_ids" (@quote[:user_ids] = @params[:quote][:user_ids]). In this form I have all users and I just check those I want to tie to this quote, however
2006 Apr 18
9
SQL Syntax Errors
Hi, I''m running Rails on Mac OS X 10.4. I''ve installed ruby/gem from darwinports, and then rails through gem. I have a recurring problem where I get an SQL syntax error: Mysql::Error: #42000You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '''' at line 1: INSERT INTO
2006 Jan 30
0
Adding ActiveRecord objects to the session
Hi all, I am creating an AJAX quoting/puchasing system and I am having a bit of unexpected behavior when adding ActiveRecord objects to the session. When I add the ActiveRecord object (in this case QuotePart) to the session it automatically saves the object that was added to the session to the DB. And the oddest part is that it automatically fills in the foreign key field quote_id, even though
2006 Jun 13
13
Pass infomation between different views and controllers
Hi, I am a rails and ruby nuby :-) How do you pass data between different controllers and views? I have a page ( a quote) that I am editing url ....quote/edit/6 6 id the current id. I then go to a catalog (url....catalog) to add an item to my quote (I do this via a line_item file that the quote reads) I now want to go back to the quote. I have tried this <%= link_to ''Back to
2006 Apr 28
7
acts as drop down
Hi Im using the acts as drop down plugin and have this code below acts_as_dropdown :text => "forename", :order => "forename" It currently makes use of the forename in the option tag, how can I get it to use the surname as well ie somthing like ''forename'' . ''surname'' in php Thanks -- Posted via http://www.ruby-forum.com/.
2006 Aug 12
0
insert into database failing
hi all, i am trying a little project based on the agile book''s shopping cart example and have hit a problem. the inserts are failing when saving a quote which contains line_items. the models are as follows (quote_line_item is using single table inheritance): class Quote < ActiveRecord::Base has_many :quote_line_items end class LineItem < ActiveRecord::Base end class
2011 Oct 16
2
question: ragged array
Hello, I have a big problem which I’m just not able to solve. I created the following mean value from the following dataset structure: Id |value 1 | 2 1 | 3 1 | 4 2 | 2 2 | 1 3 | 5 4 | 3 etc.|etc. with the command: mean_rating <- tapply(ratok$value, ratok$project_id , mean,simplify = FALSE) this gives me a ragged array: > mean_rating [1] $`14`
2008 Jun 13
2
Rails 2.1.0 - find with :include and missing JOIN in SQL query
Hi, We''re trying to rewrite veeeery old Rails app that we successfully managed to move to 1.2.6 and now we''re trying with 2.1.0. One of the problems is caused by :include in AR.find. Rails 1.2.6 generates totally different SQL query than 2.1.0. Here''s Rails find query and generated SQL queries: Foo.find(:all, :include => :ticket, :conditions =>
2007 Jul 22
2
Seek brilliant Rails programmer to add one field to acts_as_taggable
I''m on the downhill side of a large project that requires an additional integer field to be added to the tag.rb in acts_as_taggable. I feel I have a good understanding of ActiveRecord and have performed the correct migrations. (As a short background for those following this thread) when one wants to add tags to a model they call the ''tag_with'' method that jumps into
2007 Nov 02
5
RSpec, RESTful nested routes and :path_prefix
Dear list, In the app we are making we have a rout something like this: map.resources :projects do |projects| projects.resources :pages, :controller =>"Wiki::Pages", :path_prefix => "/projects/:project_id/ wiki", :name_prefix => "project_wiki_" end But I can''t get RSpec(I''m very new to it) to accept this. It keeps throwing errors:
2007 Nov 14
6
a few add_index questions..
on previous apps i hadn''t really worried much about adding foreign key indexes on my tables just because they''ve been fairly small and i didn''t really think i needed them. well, i''m working on something now that has the potential to have a lot more data, and a lot more foreign keys. so i have 3 tables... users, projects, and tasks.. should i be using add_index
2007 Apr 11
12
redirection doesn''t get detected well?
I''m doing a redirect in one of my controller actions and somehow I can''t spec it, see this pastie: http://pastie.caboo.se/53120. When following the link from a browser I''m being redirected to the right page. -------------- next part -------------- An HTML attachment was scrubbed... URL:
2006 Jul 13
8
can''t convert true into integer
I have a method: ? def reduceProuctInventoryBy(product_id, reduction) ? ? t=Product.find(:first, :conditions =>["id = ?", product_id]) ? ? t.qty=(t.qty-reduction) ? ? t.save ? end and the model: class Product < ActiveRecord::Base ? validates_presence_of :qty, :specialDescription ? validates_numericality_of :qty end but when i run my method, I get this: "can''t
2008 Sep 06
6
Active record question
I''m not quite sure how to get at this data using Actrive record.. I''m trying to get all the appointments made for a particular project. I''m using four models, Projects, Tasks, Resources and Appointments. The SQL gets me what I''m looking for but how do I do it using Active Record? Select a.* from appointments a join resources r on r.id = a.resource_id join
2005 Nov 16
1
HABTM: deleting records based on attributes
Hello All, I am new to ROR, and can''t seem to get HABTM to cooperate entirely... however I might be abusing it! Before I try a different strategy I thought I''d ask here and see if I''m missing something simple. So say Projects and Companies are related. Projects can have multiple Companies, and Companies can be on multiple Projects. But, the same Company can also
2006 May 10
2
gain value from form
I have the following form <%= start_form_tag :action => ''rejectQuoteSave'', :id => @project %> <p><label for="offer_reason_rejected"><span class="required">* </span>Reason</label><br/> <%= text_area ''offer'', ''reason_rejected'' %></p> <%= submit_tag
2007 May 06
1
validates_uniqueness_of (with :scope) doesn't seem to work?
I have a master record called ''project'' and a child record called ''agycode''. Obviously, agycode has a project_id FK. I wish to make the "descr" field unique ONLY within the ''project_id'' ''scope''. Here are the key pieces of information Agycode fields (id, project_id, descr) Here''s the declaration in the