Displaying 4 results from an estimated 4 matches for "laduk".
Did you mean:
kaduk
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 Apr 18
4
how would you take the duplication out of this?
i have these two really similar methods in my addressbook controller.
def edit_company
@company = Company.find(params[:id])
if request.post? and @company.update_attributes(params[:company])
flash[:notice] = ''Company was successfully edited.''
redirect_to :action => ''show'', :id => @company
end
end
def edit_person
2006 Apr 18
1
what happened to my increment_counter method?
this used to work for me. i started re-writing my little app and now
it doesn''t work.
here''s my models:
class Company < ActiveRecord::Base
has_many :people
end
class Person < ActiveRecord::Base
belongs_to :Company, :counter_cache => true
end
then i go into my console and say:
c = Company.find(:first)
c.increment_counter
and its all like "waaaaaaH"
2006 Feb 28
1
this feels ugly
i better explain a little to get started.
in my form for creating a Person, there''s a Company field. People
belong to companies and companies have many people.
in my person form i have:
<%= text_field ''person'', ''Company'' %>
in my controller i have
def create
params[''person''][''Company''] =