similar to: Using .find_by_sql for database/admin queries

Displaying 20 results from an estimated 2000 matches similar to: "Using .find_by_sql for database/admin queries"

2006 May 23
8
ad-hoc query
How do you run an ad-hoc query that does not belong in any model? I thought it was something like ActiveRecord::connection.find("my query..."), but I can''t seem to find the documentation on it. I know I''ve seen it somewhere before, though. thanks, Jeff -- Posted via http://www.ruby-forum.com/.
2006 Apr 20
3
has_many :through with has_many/has_many join models
It seems that using a join model that joins with two has_many''s will fail to generate proper SQL class StudentSemesterRecord < ActiveRecord::Base belongs_to :semester has_many :discipline_records, :through => :semester end class Semester < ActiveRecord::Base has_many :student_semester_records has_many :discipline_records end class DisciplineRecord <
2009 Sep 28
3
rjb: Java classes in Rails
Hi, For those who might not be aware, rjb is a killer gem for using java classes inside your rails app (or any ruby code). Check it out at: http://rubyforge.org/projects/rjb/ I was able to successfully use it in one of my apps that required some code that is only available in java. And it''s much nicer than having to compile a java app, then shell out using backticks, get back the return
2006 May 30
6
How to solve "Marshal Data Too Short" error?
Hi I''ve got the error in the log file "marshal data too short" after I try to store some data into session. After doing some research on the internet, it looks like the problem was caused by pstore.rb. It is there way to solve this problem? Thank you -- Posted via http://www.ruby-forum.com/.
2007 Jun 05
4
uninitialized constant RailsHandler::Dispatcher
Hello, I am running in to an error trying to run mongrel. The server starts but then trying to access any url in my application throws this error: calling Dispatcher.dispatch uninitialized constant RailsHandler::Dispatcher ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:477:in `const_missing''
2005 Dec 21
7
use of SET command in find_by_sql
Hi, I''m trying to execute something like this method in a model: def self.sql_for_rankings() sql = "SET @counter:=0;" sql << " SET @counter:=0; SELECT *, @counter:=@counter+1 AS rank FROM testscores. " find_by_sql(sql) end Where the new rank column is a kind of autoincrementer inside of
2007 May 21
7
How do I stop a column being updated by model.save?
One of my models has a column that is updated very frequently from a separate process, so it is important that when a record is saved in rails, this column should be left alone. In the update method of the controller I have: @record = MyModel.find(params[:id]) @record.update_attributes(params[:my_model]) params[:my_model] doesn''t have a reference to the column I''m talking
2006 Feb 03
6
Go back to previous action
Hello all! I have two views (list_1 and list_2) that show a list of users in two different ways. In the views for these actions there is a link to edit a specific user properties (edit_user). That works fine, except that when I change the user I want to go back to the view that originated the request and not to the default list (list_1). Can anyone help me? Best regards, Hugo -- Posted via
2005 Oct 19
35
Why you MUST use SCGI for Rails development
Hello happy Railers, I used to develop with a local out-of-the-box Apache and load times were pretty slow (like a few seconds each page). "Well, it''s the price to pay for no compile / cache / etc..." I thought. Nonsense. Yesterday I installed SCGI, and now I''ve got the best of both worlds: rails development env uses my very latest modifications, while SCGI ensures I
2006 Feb 16
5
Firefox and IE performance with Rails App
In my rails application, certain computers were having huge problems. There were certain pages that were exceptionally slow, even to the point of timing out. Other computers did not have a problem. I finally found that Firefox was the difference. When using Firefox on those computers it works fine. The slow pages were typically posting a form with a couple hundred fields. This behavior was
2005 Dec 15
3
define_method with parameters
Hi, I''m trying to write a macro which defines methods. One of these should have a parameter, but I can''t get that to work. Something like: define_method("printstuff") do puts "blabla" end works fine. But, how do I use define_method to create something like: def printstuff(the_stuff) puts the_stuff end Thanks in advance.
2007 Aug 14
1
find_by_sql vs connection.select_all
I was trying to do SUM based mySQL query simliar to the following: SELECT SUM(updated_on - created_on) AS total from signups If I were to run this command in the mySQL console I would get a result. However, if I were to run it using the following command in Rails: Signup.find_by_sql("SELECT SUM(updated_on - created_on) AS total from signups") The query that is written to the log is:
2009 Jan 13
9
Updating multiple databases at the same time
I have an application that is load balanced. I have a master database which I update once a day. Then I push the raw mysql files to all other servers so they are the same as the master. This works fine, but there are a few situations where I need all databases to update in real-time. What would be the best way to achieve this in rails? Here is an example of what I am trying to do. I want to
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 Jan 15
6
PROPOSAL: Validations as Mixin
It seems to me that Validations are quite useful for many objects, even ones having nothing to do with ActiveRecord. Common examples are Contact Us forms, multi-step forms, web service paramater validations, etc. I took a look at the source for Validations, and it seems that it is very independent from ActiveRecord. I caught only three depenedencies: 1. validates_numericy --> depends on
2016 Sep 01
2
RFC: FileCheck Enhancements
Yes, I now understand what you suggested. > CHECK-DEFINE-PATTERN: car(make, model, year): {{Found a }} make model {{, from }} year But I think that in pattern I should show that I use parameter. I thought that patterns can also be simple strings. All strings should be regexs in pattern and parameters can't be used in pattern in your example. But I want to use parameters in regexs. For
2016 Sep 01
2
RFC: FileCheck Enhancements
I wanted to start making some change. But I thought and I don't understand why it's necessary to add @. // RUN: FileCheck %s // CHECK-DEFINE-PATERN: register(n): {{[a-z]+}}n // CHECK: %[[register("1")]] // CHECK-SAME: %[[register("2")]] // CHECK: %[[register("1")]] // CHECK-SAME: %[[register("2")]] This example will be equivalent to // RUN:
2010 Sep 20
5
Update to website not printing special Characters
I thought you might be interested in how far I have got with solving my problem with MySql(via phpMyAdmin) to website character_set problems. I thought I had solved the problem when my characters on my website started showing the special characters. This was a partial success though. When I went back to phpMyAdmin and entered new text the problem was the same, but reversed. What now happens is
2016 Aug 24
9
RFC: FileCheck Enhancements
Hi all, Some discussions and comments were made in reviews. Much time has already passed since last comment and uploading changed patches. I made small summary report about features here, because there are some doubts about syntax of some features and changes in patches and it'll be great to know more opinions. 1. FileCheck Enhancement - CHECK-WORD (https://reviews.llvm.org/D22353) I replace
2016 Sep 05
2
RFC: FileCheck Enhancements
Ok, when I change syntax I will load new patch. Thanks, Elena. -----Original Message----- From: vsk at apple.com [mailto:vsk at apple.com] Sent: Thursday, September 01, 2016 9:38 PM To: Elena Lepilkina <Elena.Lepilkina at synopsys.com> Cc: Mehdi Amini <mehdi.amini at apple.com>; llvm-dev at lists.llvm.org Subject: Re: [llvm-dev] RFC: FileCheck Enhancements It is necessary to be