Displaying 20 results from an estimated 3000 matches similar to: "Pass infomation between different views and controllers"
2006 Jul 08
4
Hidden fields in forms
Please can someone show me the correct syntax for a hidden field in
forms, this is my code
<%= start_form_tag :action => ''create'' %>
<div class="form1">
<table width="auto" boader="8" cellspacing="5" cellpadding="5">
<% hidden_field ''line_item'', ''client_id'', :value
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 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 Jul 27
2
setting initial text field values in a form
Hi,
I am trying to create a basic form in which I want one of the fields
initialized before displaying it.
My code (in a view) is as follows:
<%
if ( session[:user_id] != nil )
then
logged_in_user = User.find(session[:user_id])
end
%>
<% form_for :suggestion do |form| %>
<label for="suggestion_title">Topic:</label><br/>
<%=
2006 Jul 09
17
Has many / belongs to error with mysql
Hi,
I''ve got stuck with a problem on my rails app - I''ve created a database
for quotes and bookings, with a futher table "eventdetails" (details of
a quote or booking) linked one-one for both tables using a polymorphic
assciation. This all works, but I am now trying to link a quote to a
number of bookings with a has_many and belongs_to (the foreign key is in
the
2006 Feb 24
7
One To Many To Many
Hey all,
I''m trying to find a simple way to reference all of the objects that
belong to their parent''s parent. In other words:
Clients --> Orders --> LineItems
How do I get all of a client''s lineitems in one array (i.e.,
client.all_lineitems)?
Thanks!
-Neal
--
Posted via http://www.ruby-forum.com/.
2006 Feb 07
11
breaking down a list view
I''m trying to figure out how to change the order of a list view and it''s
obvious to me that I don''t understand what I get from a simple scaffold
to know enough to alter it.
If someone would be so kind to tell me what this means ...
def list
@placment_pages, @placements = paginate :placements, :per_page => 10
end
@placement_pages, # I am guessing that this
2006 Apr 17
5
XML-RPC Webservice API
Hi,
After following the excellent tutorials in the Agile Web Development
with Rails book, I was able to get my webservice working pretty much
perfectly :)
I can access it via SOAP and XML-RPC and look at service.wsdl to find
the API. What I can''t do however is get the API for the XML-RPC call. It
fails with :
Internal protocol error: NilClass is not a valid input stream. It must
2006 May 18
7
Server out to excel
How would one server out to excel a html table with the mime/content
type
application/vnd.ms-excel ?
In PHP it would be something like
?php
header("Content-Type: application/vnd.ms-excel");
------
But how do I do this in rails?
Cheers Glenn
--
Posted via http://www.ruby-forum.com/.
2006 Jun 21
5
newbie - question on radio_buttons
I have a view with a form and i want to be able to process the button
selected in a controller - not sure how to do this. The form does not
map directly to a model - all I want to do is be able to pass back the
selected button and know which one it is.
So, i have a form and several radio buttons - the submit (not shown)
takes me to the process_answer action where I want to determine which
2007 Jan 05
4
How To Spec Controllers with Finders
Given this code (which renders rjs), I''m faced with the fixture-
driven way of spec-ing or mocking. How the heck to you mock this so
the code at line (2) and (4) work right? I''m still struggling with
mocks but it seems like this can be done. Forgive the naivety of this
question.
1. def change_quantity
2. @line_item = LineItem.find_by_id(params[:id])
3. unless
2006 Jun 26
8
id of last element in a table
Hi,
I would like to figure out how to determine what the id of the last
element in a table is. Is there an equivalent to the Table.find() method
which will tell me the number of elements in a table? also, maybe more
importantly, where are the available methods on tables documented?
What i am trying to do is to increment the id and work through a table
and check whether the id i am currently
2006 Jun 14
3
How to use at_beginning_of_year
I want to get the Date in formation YYYY-MM-DD for the start of the
current year
But I cannot think how to do it...
This generates a name error .rhtml view.
<%= at_beginning_of_year.Time.now %>
--
Posted via http://www.ruby-forum.com/.
2007 Nov 20
3
How to test views with Nested Resources and Partials
Hi everyone,
I am relatively new to rspec and I am running into a wall in testing my
views. I have a RESTful resource Contracts with a nested resource of
Line_items.
I am trying to figure out how to test the "edit" form of the Line_items.
What complicates this is the nested routing and how to account for it,
and that there is a partial form (_form.haml) that both the edit.haml
and
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 Feb 16
9
association not inserted automatically.
Hello,
I am trying to write a sample application.
I have
class LineItem< ActiveRecord::Base
belongs_to : order
end
&&
class Order < ActiveRecord::Base
has_one :line_item
end
Now in the controller i am trying :
def add
@ord = Order.new(params[:ord])
@ord.line_item = LineItem.new(params[:lineitem])
if @ord.save
redirect_to :action => ''list''
else
render
2006 Jun 27
25
1.1.3 available.
Hello,
DHH has just announced the release of Rails 1.1.3
http://weblog.rubyonrails.org/2006/6/27/rails-1-1-3-security-fix-and-minor-fixes
rails-1.1.3
activerecord-1.14.3
actionpack-1.12.2
actionmailer-1.2.2
actionwebservice-1.1.3
The announce without the repetition :)
"Rails 1.1.3: Security fix and minor fixes
Posted by David June 27, 2006 @ 08:07PM
We''ve found and fixed a
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
2008 Jul 17
1
child xxxxx (imap) returned error 83 (Out of memory)
Hi list,
> Jul 17 12:15:10 seamus dovecot: IMAP(someone at somehost.org): block_alloc(): Out of memory
> Jul 17 12:15:10 seamus dovecot: child 26181 (imap) returned error 83 (Out of memory)
I found those two entries in the logs this morning. The system has
ample free memory. What's going on?
--
martin | http://madduck.net/ | http://two.sentenc.es/
"i wish i hadn't slept
2006 Jan 13
5
Form field naming semantics question
Hi,
I have a question today regarding how the various form elements in
_form.rhtml are named.
I understand that for a database table "persons" with a column headed by
"name", then in _form.rhtml it will probably be like:
<p><label for="person_name">Name><br/>
<%= text_field ''person'', ''name''