Displaying 20 results from an estimated 1000 matches similar to: "going crazy!!!!!! ActiveRecord::StatementInvalid in Project"
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 25
2
Noob Question: Regarding Form
I''m hoping there''s an easy way to do this. I''m trying
to read options from a database, and insert them into form tags. So
for example,
In the Database Table: options
size: 300
type: text_field
maxsize: 300
and I want to create a text_field form tag, with all the appropriate
options, is there an easy way to do this, other than having the code
output the HTML
2006 May 01
4
When to make a new controller
Hey all,
Ok this is probably a newb question, but I haven''t been programming with
MVC for very long, and I''ve been wondering what the general opinion is,
or best practices, for making a new controller. Like what cases would
you need a new controller for and what cases can you just put everything
into one controller?
Thanks in advance,
Randal
--
Posted via
2006 May 08
4
set forign key
hi,
got a small problem below and not to sure how to overcome this using
rails
two tables involved with this projects and quotes
each project has a field quote_id as a forign field.
When a user is ready to upload a quote they are linked to quotes/new
from the show project page. Once the quote is uploaded how can I then
set the quote_id field with the correct key?
--
Posted via
2006 May 02
3
Ordering Results returned by has_many relationship.
Noob Question 31,265,232
if I''m searching on an object, say order, that has many "order_lines"
and I want to display order lines by Quantity ( an attribute of the
order_lines ) descending
how could I do that without having to do a find() with :order, but
something like;
Order.order_lines.each do |ol|
<!-- code to diplay the line -->
how can I determine the field
2006 Feb 14
7
9cays - A Rails app for Group Email
Even though it''s a little OT, I thought I''d announce the free public
beta of a new Rails app that I''ve been working on for a while:
http://9cays.com
Think of it as mini-mailing list software. For a lot of smallish
conversations, normal mailing list are too heavyweight (requiring
setup, moderation, admin, etc.), but group email is a pain because
messages
2006 May 09
6
RJS, & mulitple Drop Down Boxes.
Hello Again Rails Folk!
I''m trying to creat a page similar to what the person is doing here...
http://mudabone.com/aietc/?page_id=410
Instead of doing it the way he/she has, I decided to use RJS files, or
at least I tried.
Here''s my view
<%= start_form_tag %>
<%= javascript_include_tag "prototype" %>
<p>
Union:
<div id="union">
2006 May 21
3
Using ParseDate in for loop
Hi,
I''m trying to use ParseDate within a for loop but I get this error:
can''t dup NilClass
Any suggestions for making this work?
Thanks,
-Jason
2006 May 03
3
using select_date causes errors...
I''m getting errors whenever the user chooses, for example, April 31st (
since there is no 31st in April, navicat freaks out ), there MUST be a
method that ruby has that would allow me to validate a date before I
submit to navicat.
I haven''t been able to find anything online about it either, it''s
probably something simple, I just can''t figure it out.
Thanks
2006 Jun 10
3
Weird Problem With Active Record
Is it me or is my model getting the created_at from the wrong model!
I have a HABTM relationship between Problems and Tags. In one of my
controller I do the following:
def view
@tag = Tag.find_by_name @params[:id]
end
In my view I do this:
<% @tag.problems.each do |problem| %>
...
<%= problem.created_at %>
...
<% end %>
Now, how come the created_at
2006 Feb 23
2
find_by_sql aliasing issue when accessing attributes
I was recently having problems accessing attributes in an object. Can
somebody explain to me why this is, and if it is a bug?
I have the following code:
@archives = RapturePost.find_by_sql "select distinct
date_format(rapture_posts.date_created,''%Y-%m'') date_created from
rapture_posts where rapture_posts.site_id = 1 order by
rapture_posts.date_created desc"
I
2006 Feb 22
2
accessing an attribute within an embedded object
When I dump an instance variable to the web browser using object.inspect
I get the following:
This:
<%= debug archive.inspect %>
Yields this:
#<RapturePost:0x2aaaacada118
@attributes={\"date_created\"=>\"2006-02\"}>"
How do I access that date created value?
Neither of the following work. The don''t give me the actual date value,
only nil or
2006 Apr 16
8
"Cannot convert String to Integer" after using association
So, I''ve written a partial that does some stuff with a given instance of
my class "entity". Entity is ActiveRecord. I''m able to retrieve all
sorts of data from an @entity, until I do something like:
<% for @attribute in @entity.attributes %>
<div id="attribute_<%= @attribute.id %>">
<%= render(:partial =>
2006 May 31
3
instance variable problem
I''m having some trouble with an instance variable being read as nil in
my app. I have an image uploading, that can be added to categories.
The page loads up initially fine, and if I upload an image without
errors everything works fine. I''m working on the validation, but with
the code I have if their are validation errors it renders ''new'' again,
but reads
2006 Jun 01
3
more questions: human_name
One more question:
Is there some way to set the human_name of a column? e.g.: human_name
for column address1 shouldn''t be Address1 but "Address, line 1".
If not, should I make a hash with my custom names?
Best regards,
--
----------------------------------------------------------------------
Yannick Majoros http://www.inma.ucl.ac.be/~majoros
Informaticien UCL/INMA-MEMA
2006 Jul 09
8
Can the has_many create() method return an ID?
Hi all,
I have a has_many relationship, Cookbook :has_many Recipes
If I want to create a new recipe in my cookbook I do:
cookbook.recipes.create(data)
It would be nice if I could then easily get the id of the new recipe,
but the create() method doesn''t seem to return anything. Any ideas how?
Thanks in advance!
Cameron
--
Posted via http://www.ruby-forum.com/.
2006 Jun 29
1
before_destroy & verification
Hey, probably an easy question but,
I''m trying to get a method to run "before_destory" for a model, and I
want the method to throw an error, and not delete the object from the
database, if a certain condition is held
Obviously, I can just raise an error and rescue it... but for some
reason I can''t get <% error_messages_for ''model" %> to catch
2006 Jun 11
4
remote_function posting?
Hi, I''ve noticed that my remote_function calls are resulting in POST
requests. As a result, my routes do not apply since it does not generate a
url based on the parameters, but simply posts to the raw url with post data.
I want to make a GET request instead of a POST. How can I do that? Has
anyone else run into this?
Thanks, Ryan
--
View this message in context:
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 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