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?
on 2006-05-09 17:57
on 2006-05-09 18:09
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.
on 2006-05-09 18:25
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!
on 2006-05-09 20:27
I remember reading somethign about QUOTE being a key word... try something else other than QUOTE.
on 2006-05-10 01:43
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.com
on 2006-05-10 01:52
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 2006-05-10 10:04
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.com my quote .rb file begins with class Quote < ActiveRecord::Base
on 2006-05-10 11:25
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