ss
2006-May-09 15:58 UTC
[Rails] 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`) VALUES(, , , , , ) all seem sto go wrong when I call if @project.save however when I change belongs_to :quote to belongs_to :quotes (extra s on the end) Everything seems to work here as expected. any suggestions why thi sis happening? -- Posted via http://www.ruby-forum.com/.
Randal Santia
2006-May-09 16:09 UTC
[Rails] Re: going crazy!!!!!! ActiveRecord::StatementInvalid in Pro
Does a project belong to many quotes? As for the mySQL error, you''re not submitting any data with the call... I''m assuming the ids can''t be empty. Make sure you''re setting everythign that needs to be set before you insert... it looks like you''re inserting an empty row. -- Posted via http://www.ruby-forum.com/.
ss
2006-May-09 16:25 UTC
[Rails] Re: going crazy!!!!!! ActiveRecord::StatementInvalid in Pro
Randal Santia wrote:> Does a project belong to many quotes? > > As for the mySQL error, you''re not submitting any data with the call... > I''m assuming the ids can''t be empty. > > Make sure you''re setting everythign that needs to be set before you > insert... it looks like you''re inserting an empty row.no quotes.rb has_one :project and project.rb belongs_to :quote with the forign field quote_id being in the project table As far as I ama aware everything is set up, I even define @project.date_created = Time.now before project.save and this does not get included. if i remove the has_one and belongs to, everything works fine! -- Posted via http://www.ruby-forum.com/.
Randal Santia
2006-May-09 18:27 UTC
[Rails] Re: going crazy!!!!!! ActiveRecord::StatementInvalid in Pro
I remember reading somethign about QUOTE being a key word... try something else other than QUOTE. -- Posted via http://www.ruby-forum.com/.
Pete Yandell
2006-May-09 23:42 UTC
[Rails] Re: going crazy!!!!!! ActiveRecord::StatementInvalid in Pro
On 10/05/2006, at 2:25 AM, ss wrote:> Randal Santia wrote: >> Does a project belong to many quotes? >> >> As for the mySQL error, you''re not submitting any data with the >> call... >> I''m assuming the ids can''t be empty. >> >> Make sure you''re setting everythign that needs to be set before you >> insert... it looks like you''re inserting an empty row. > > no quotes.rbShouldn''t this be quote.rb? Is your model class called Quote or Quotes? It should be Quote. Pete Yandell http://9cays.com
Liquid
2006-May-09 23:50 UTC
[Rails] going crazy!!!!!! ActiveRecord::StatementInvalid in Project
If you generated the model / controller with the command ./ script/generate scaffold quote I believe it makes it into quotes. Check your quote model file. If it says class Quotes < ActiveRecord::Base ... The you need to use belongs_to :quotes On 5/10/06, ss <scott@boxuk.com> wrote:> > 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`) > VALUES(, , , , , ) > > > > all seem sto go wrong when I call > if @project.save > > however when I change > belongs_to :quote to belongs_to :quotes (extra s on the end) > > Everything seems to work here as expected. > > any suggestions why thi sis happening? > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060509/f6f95377/attachment.html
ss
2006-May-10 08:05 UTC
[Rails] Re: Re: going crazy!!!!!! ActiveRecord::StatementInvalid in
Pete Yandell wrote:> On 10/05/2006, at 2:25 AM, ss wrote: > >> no quotes.rb > Shouldn''t this be quote.rb? Is your model class called Quote or > Quotes? It should be Quote. > > Pete Yandell > http://9cays.commy quote .rb file begins with class Quote < ActiveRecord::Base -- Posted via http://www.ruby-forum.com/.
ss
2006-May-10 09:25 UTC
[Rails] Re: going crazy!!!!!! ActiveRecord::StatementInvalid in Pro
Randal Santia wrote:> I remember reading somethign about QUOTE being a key word... try > something else other than QUOTE.I have taken a look at this and renamed everything, and it all seems to work now, however I couldnt find this word on any reserved keyword list. Could this be a bug or just not documented? a bit of digging also led to this post http://www.ruby-forum.com/topic/151#488 -- Posted via http://www.ruby-forum.com/.