Displaying 20 results from an estimated 200000 matches similar to: "Accessing other databases"
2006 Apr 11
5
multiple select_tag
Hello again,
I have a table called line_items, with the following fields:
id int
item_name varchar()
qty int
conditions text
I''ve made my LineItem model, and everything works as such (with simple
text_fields)..
Now I''d like for the conditions field to be a select_tag() with multiple
choice possibility.
I''m guessing I need some code to expand/restract the array for
2006 Apr 05
7
select_tag - populating options
Hello,
I want to a select tag, where you can choose a number between 1 and 100.
My inital code is based on the examples from Agile Web Development with
Rails, and looks like this:
view:
<%= options = [["Select number of lines", ""]] + RfqLines::LINE_QTY
select("rfq_line", "line_qty", options) %>
model:
LINE_QTY = select_fill
def
2006 May 02
5
listing parents from child conditon
Hi,
How can I grab all parents in a table, depending on a condition in the
children table ?
Fx.
def list
@projects = Project.find(:all)
end
will find all projects in my table. Now let''s say I want show a similar
list, for all open projects.. I define an open project, as all lines
(Line has belongs_to :Project) that do not yet have a closed_at
timestamp set.
So basically, I want
2006 Jun 23
2
Foreign key - relations
Hello,
I''ve got DB like this:
(roughly)
create table projects (
id int auto blabla,
name varchar(200),
user_id int,
sales_id int);
create table users (
id int auto..,
name varchar(50));
So project.user_id has a foreign key to user.id - all is good.
Everything works fine.
Now my question..
How can set a relationship from two different fields to the users table
??
Fx.
2006 Mar 07
6
Flickr - Tutorial
So I''ve pretty much followed the steps in the video tutorial on RoR.com
for creating a small app, to search for photos on flickr.com - all is
good, and works as intended to..
How would I go about adding validation, so if no tags are specified it
will fail. I know I have to use validates_presence_of :tags - but not
in the controller.. so I tried to generate a model called
2006 May 31
3
textfield_with_auto_complete - filling two fields
I am going nuts here..
I have a form where users can write a city name (used with
auto_complete) - and once they click on the desired city in the dropdown
menu - I would like to have the Country field filled automatically as
well...
Is this possible at all ?
If so, can somebody please tell me where I can find some documentation
on the subject, or preferrably an example ?
Many thanks in
2006 Apr 06
3
Inserting parent_id
I have two tables:
- projects
- lines
lines has a foreign key constraint to projects.id
When I''m creating a new line object, the database fails on insert with
the following error:
"PGError: ERROR: null value in column "project_id" violates not-null
constraint"
My code looks like this:
def create_lines
@project = params[:id]
@line =
2006 Jul 04
1
options_for_select - default nil value
I have a field in a view, like so:
<%= select_tag(''quoted_condition'',
options_for_select([''NEW'',''RETAIL'',''OEM'',''REFURB''], ''NEW'')) %>
This sets the ''selected'' value to ''NEW'' - however, I would like to have
a nil value here, so I can
2006 Mar 13
7
Wilcard search
Hello,
I''m writing a search function for my application, but I am unsure on how
to search for all results that contain my search string; here''s what
I''ve got:
def search
@products = Product.find(:all,
:conditions => "date_available < now()",
:conditions => [ "title ilike ?",
2013 Jan 04
3
help "reshaping" dataframe
List,
I want to reshape my data, but I'm not sure how to do it... it might be a
simple task, but don't know which package does this.
"occ.data" (see below) is how my original data are arranged, and I know
that with melt() I can reshape it like "y" (see below). However, I just
want to build a matrix like the "y" matrix, but with only 2 dimensions.
Something
2009 Apr 03
1
Functions Accessing Databases
Hello,
I'm accessing a MySQL database from inside R and had a problem with a function. In the database, there is data from years 1985 to 2007 that I would like to retrieve. I can easily get the data from one year by the following:
info1985=dbGetQuery(con, statement='the SQL query')
Inside the statement, I have a column that is set to the desired year (e.g. table.column=1985) through
2012 Feb 16
2
import .csv file into R
Dear r-helpers,
I read a .csv file into R
with the following command:
A<-read.csv2(file="Mappe3.csv")
It worked fine, except that I would like to get rid of the points between
the words and get spaces instead like I have got in the .csv file.
At the moment it looks like the following:
habe.mich.gut.mit.KlassenkollegInnen.verstanden
hatte.gutes.Verhältnis.zu.Eltern
2006 Aug 07
1
apache-fcgi - multiple applications on same server
hello,
I have a server running apache-1.3 with mod_fastcgi that''s happily
running a rails application. Life is good ;)
I would like to setup another application (vhost) on the same server..
How to do ?
My httpd.conf says:
<snip>
# fastcgi
<IfModule mod_fastcgi.c>
FastCgiIpcDir /tmp/fgci_ipc
AddHandler fastcgi-script .fcgi
FastCgiServer
2006 Jul 17
2
count and result
What is the equivelant of the following SQL in rails:
SELECT person, count(person) as occurance FROM invoice GROUP BY person;
This would give something like:
Person | Occurance
--------------------
Bill 1
Joe 15
Carlos 7
etc etc..
It seems the fx. Person.count(..) will only yield the actual occurance,
but not listed with the actual person - and Person.find(..) will not
2007 Mar 06
2
New eudora problem - "mswmsg" not supported
I just upgraded from v0.9.9 to v0.9.32 (on Ubuntu 6.06) and Eudora Pro v4.2
stopped working. It no longer opens a mailbox when the icon is clicked. The
log shows "fixme:rpc:alloc_serverprotoseq protseq "mswmsg" not supported"
each time I click to open a mailbox.
This was working on v0.9.9 so I am looking for ideas as to how to work
around this problem. There is a bug
2006 May 15
4
Other databases...
I''m a newbie to Ruby and I was wondering if Ruby on Rails will work with
databases that has a ODBC/JDBC driver or does it ONLY work with the
databases that it list in it''s documentation?
Thanks
--
Posted via http://www.ruby-forum.com/.
2006 Oct 06
1
Storing multiple choices in databases
As an example - you have a select list of all the U.S. states and the user
can make multiple choices.
How do you grab all those choices into the database and they would be used
for queries.
I was reading up on serialize() but the warning in AWDWR is that it doesn''t
work well for queries. Also composites / aggragates seems a bit much, maybe
not.
I know in the past I''ve used
2010 Oct 06
16
Dealing with an EAV database
I''ve inherited an EAV database and there''s really no option to remodel
it. Data is stored as key_name, key_value pairs
Trying to return a meaningful, unified recordset is far too complex to
be efficient.
I''ve decided to make use of the MySQL GROUP_CONCAT, and CONCAT_WS
functions to return a fast query result, with the consolidated fields
as one string.
The final data is
2006 Mar 19
1
accessing speed dial database
I'm currently running asterisk@home v 2.7.
However I believe asterisk has inbuilt a system wide speed dial system.
Preserved number range starting at 300.
Just wondering if it's possible to view/backup/restore/modify this data
without having to enter it in manually.
e.g. 300 301 12345678 (to save phone number 12345678 in speed dial 301?)
I'm looking at creating a new installation
2011 Apr 25
3
Active Record database time logging
I''ve been having a look through the code responsible for printing how
much time was spent in Active Record at the end of an action. My
reading of the code + experiments suggests that any database time
after the render is not counted.
It seems to me that in controller_runtime.rb in Active Record,
append_info_to_payload should in fact read
def append_info_to_payload(payload)
super