similar to: ad-hoc query

Displaying 20 results from an estimated 300 matches similar to: "ad-hoc query"

2013 Mar 07
1
HELP:Custom function didn't work
hi,guys- I have a mysql database which stores host informations,so I wrote a function to get some values. - Here is the function rb(this function should return the type I defined in the database): #hosttype.rb require "mysql" module Puppet::Parser::Functions newfunction(:hosttype, :type => :rvalue, :doc => "Gets host type from db.") do |args|
2006 Apr 30
4
Adding values from a db the rails way?
I have a log table which has a column recording the number of hours worked on a task. So there''ll be multiple lines for a particular task. I want to retrieve the total number of hours worked on a task, so that I can include the information when one views the task details. I can write a sql query to do this easily enough, like "SELECT SUM(hours) AS total FROM tasklog WHERE
2008 May 30
9
find_by_sql without a model? how to do this?
Hi, I''d like to do a "find_by_sql" without a model (e.g. <model name>.find_by_sql("...")) as the results I get back are a once off special, and I''m happy to handle them as an array. How do I do this? "ActiveRecord::Base.find_by_sql(...)" does not seem to work? Background - At the moment I''m doing within a model <model_name>,
2006 May 16
25
Ruby on Rails Searchable and Annotatable Docs
I recently updated my Rannotate application. The interface has been completely redone and there are lots of new features. The basic idea is to create searchable and user annotatable documentation for the Ruby on Rails API (think php.net). Check it out at - http://rails.outertrack.com * What is Rannotate? Rannotate is a Rails application and RDoc YAML generator that work together to provide
2006 Jun 05
5
adding habtm through migrations
Hello, I''m stuck, I''ve got a model Product and would like to add a new model called Category. Furthermore, I want to set up a many2many relationship between the mentioned models. the problem is that I do not know how to set the primary key in the categories_products table. this is what I''ve got in my migration file: create_table :categories do |t| t.column :name,
2012 Sep 13
3
Creating a link_to from a collection_select
I want to be able to change one attribute of a link_to to be what is the current selection of the collection_select. And needless to say I can''t quite figure it out. app/views/tasks/show.html.erb Who would you like to assign this task to?<br /> <%= link_to ''Myself'', :controller => ''task_queues'', :task_id => @task.id, :action =>
2006 May 28
9
Railsmanual.org
Did anyone else catch the redesign? I don''t know who''s responsible, but it''s lookin better! Good job... -- seth at subimage interactive http://www.subimage.com/sublog/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060528/f9f92618/attachment.html
2006 Jun 16
4
Unit test and get request with a URL
I''m tyring to write a unit test that uses a get() method to simulate a get request in my functional test. However, get wants an action, and I have a URL. I''m trying to redirect to a URL the user tried to hit before logging in. After they login I want to go back to the URL they originally tried. I can''t find the get() method code in the help or otherwise. I
2006 Jul 16
4
Calculations across multiple tables
I have a time tracking app where (pseudo-code) Client has_many Task has_many TimeRecord TimeRecord start_at, :datetime end_at, :datetime What I''m trying to do (and I have done using find_by_sql in the past) is get a sum of the timespan given by ended_at - begun_at for each client. Is it naive to imagine that AR''s calculations will span relations to provide a grouped
2007 Dec 04
10
ActiveRecord::AssociationTypeMismatch
I have the requirement to empty the association records and add the association records as new (as below). @task = Task.find(params[:task_id]) @task.task_users = [] params[:ids].split(", ").each do |court_user_id| task_user = TaskUser.new(:court_user_id => court_user_id) @task.task_users << task_user end @task.save This is not working. Following error is thrown.
2006 May 23
11
putting the schema in the model files
THE SCHEMA IN THE MODEL a small write up on ''putting the schema in the model'' This is a write up on an issue best covered in a mailing list thread of Januari 2006 (see the links in the text), I repost it because I think it deserves a place on the agenda. == Why? == I was switching back and forward between the model files and the schema.rb -- off course I have
2006 Mar 14
3
ActiveRecord row-by-row processing
I want to use ActiveRecord outside of Rails to do processing on large tables. I want to be able to process the rows as they are retrieved rather than having to store the results in an intermediate array. Any suggestions? Looks like I could hack the adapter to provide an accessor to the underlying DBI handle. Anything cleaner than that?
2013 Mar 25
1
validates presence of foreign key fails in nested form
I''m using accepts_nested_attributes as follows: class Timesheet < ActiveRecord::Base attr_accessible :status, :user_id, :start_date, :end_date, :activities_attributes has_many :activities, dependent: :destroy has_many :time_entries, through: :activities accepts_nested_attributes_for :activities, allow_destroy: true end class Activity < ActiveRecord::Base attr_accessible
2006 May 22
3
Best Rails API source
Folks, Is api.rubyonrails.com the best source for RoR API info? Do any other formats exist, that are easier to navigate/search? Thanks, Marcus Marcus Blankenship Technology Services - Software Group JELD-WEN, inc. Information Systems 541-882-3451 x 2558 marcusb@jeld-wen.com RELIABILITY for real life* This correspondence is for the named person''s use only. It may contain
2006 Jul 27
5
Calculate methods on attr_accessor objects
Is it possible to use the calculate methods (sum, etc.) on attr_accessor attributes? Ie: Class Item < ActiveRecord::Base attr_accessor :total_cost def total_cost @total_cost = self.cost_unit * self.amount end calling Item.sum(:total_cost) or Item.sum(''total_cost'') both return a unknown column ''total_cost'' mysql error. I thought that active
2006 Apr 28
5
Newbie: using date-picker
Finally found a nice date chooser script (http://projects.exactlyoneturtle.com/date_picker), but am a little confused how to implement it. So I put this where I need the date picker: <a id="_name_link" href="#" onclick="DatePicker.toggleDatePicker(''name'')" class="demo_link">[ choose date ]</a> <div
2006 Jul 27
1
Update second pulldown menu based on first menu selection?
I know I''ve seen this somewhere on this board and just can''t search it anymore. I have three relational tables: clients, projects, and tasks. Currently I''m working on customizing the ''new/edit'' task _form. So far I have it listing clients in a pulldown menu so I can assign the new task to a client. I''d like to have a second pulldown select
2006 Mar 23
3
drag and drop sorting recipe
The new pragmatic Rails Cookbook has a drag and drop sorting recipe. Does anyone know if this works with 1.0? I''ve followed the recipe (i think), and I can drag but when I drop everything goes back the way it was. It seems that the sort logic doesn''t get invoked. I put this code in my view: <%= sortable_element ''task-list'' , :url => {
2010 Aug 21
2
Making a series of similar, but modified .r files - suggested method(s)?
Dear all: Any suggestions are much appreciated. I am looking for a way to make a series of similar, but slightly modified, .r files. My issue is automating making 320 .r files that change the for(i in 1:x) in my base .r file (as well as other elements, e.g., the load(...), setwd(...)). For smaller jobs running on a single computer with batch files, I have been manually changing the for(i in 1:x)
2008 Sep 06
6
Active record question
I''m not quite sure how to get at this data using Actrive record.. I''m trying to get all the appointments made for a particular project. I''m using four models, Projects, Tasks, Resources and Appointments. The SQL gets me what I''m looking for but how do I do it using Active Record? Select a.* from appointments a join resources r on r.id = a.resource_id join