similar to: Using AR.connection.execute(sql) -- messing with my string?

Displaying 20 results from an estimated 10000 matches similar to: "Using AR.connection.execute(sql) -- messing with my string?"

2010 Jul 02
22
MySQL not Connected ...... *pull hair*
I''m trying to run " rake db:migrate " and im getting an error back: ------------------------------------------------------------------------ C:\wamp\www\demoproject>rake db:migrate (in C:/wamp/www/demoproject) rake aborted! Mysql::Error: query: not connected: CREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB (See full trace by running task
2011 Dec 10
2
Couldn't find database client: mysql, mysql5, mysql.exe, mysql5.exe. Check your $PATH and try again.
Greetings, I am trying to get MySQL to run with Rails, but when I try to get it to run using "rails dbconsole" I get this error: C:\IS410\Programs\sqltest3>rails dbconsole Couldn''t find database client: mysql, mysql5, mysql.exe, mysql5.exe. Check your $PATH and try again. I have MySQL installed, along with the MySQL driver. I read alot of posts in forums saying it might
2010 Jan 31
6
Action path - syntax error, unexpected tIDENTIFIER, expecting ')'
I have a user controller with login as action. When I access the index.html.erb file via application.layout file. I get a error on the login link on the index.html.erb page. I think I am having dfifficulty in setting up path to an action or even understanding how to set REST path properly. Can someone please help me. Here is the error on the home page:
2010 Apr 20
13
why is ActiveRecord tying to select nonex ID column?
I''ve loaded (and updated) thousands of these MeteredUsage records. In the middle of a run, I suddenly get: ActiveRecord::StatementInvalid: Mysql::Error: Unknown column ''id'' in ''where clause'': UPDATE `metered_usages` SET `cost` = 12603.46 WHERE `id` = NULL I can''t see anything that''s different about this particular record compared to
2012 Jan 04
1
AR update / create pattern: is there an easier way?
I find myself writing the following frequently: r = MyActiveRecord.where(:attr1 => cond1, :attr2 => cond2, ...) r.exists? ? r.first : r.create ... which has the effect of returning an instance of MyActiveRecord if all the conditions are met, or creating one if it doesn''t. A variant of this: c = MyActiveRecord.new(:attr1 => val1, :attr2 => val2, ...) r =
2011 Jul 11
36
has_many and belongs_to association
Hi , I want to test the one below but I got the problem belongs_to :name, :class_name => "Phrase", :foreign_key => "name" in my test context "test"do should have_many :phrases end in language.rb belongs_to :name, :class_name => "Phrase", :foreign_key => "name" error is 1) Failure: test: check has_many and belongs_to
2010 Jun 03
2
creating fixtures for has_many :through
I''m stymied at how to create a fixture that establishes a has_many :through relationship. I''ve watched the railscast at: http://media.railscasts.com/videos/081_fixtures_in_rails_2.mov ... but that''s for HABTM relationships. I''ve read: http://www.ruby-forum.com/topic/145676 but that ultimately doesn''t answer any question. So with no further ado:
2012 Jun 21
6
where do I report this DateTime bug?
I have isolated what appears to be a bug in the Rails extensions to DateTime, but I don''t know where to report it. I have a standalone file to demonstrate the bug, but the punch line is that this code: TestRecord.create!(:f_datetime => (expected = DateTime.jd(2000000))) found = TestRecord.first.f_datetime puts("expected == found => #{expected == found}")
2008 Jan 15
9
using postgres rails/rake fails
hello list, yesterday i installed a fresh rails installation with a proper upgrade of gem to version 1.0.1 i saw, there is still a gem package to support postgresql known as postgres-0.7.9.2008.01.09 on rubyforge, its the newest one of stable postgres support for ruby additionally i installed, of course, a the postgres database on my machine to C:\Programme\PostgreSQL\8.2 after setting up a new
2011 Mar 01
6
render :collection calling partial with phantom object?
I have two models with a straightforward has_many / belongs_to relationship: class Premise < ActiveRecord::Base has_many :metered_services, :dependent => :destroy ... end class MeteredService < ActiveRecord::Base belongs_to :premise ... end and nested routes to match: Demo::Application.routes.draw do devise_for :users resources :premises do resources :metered_services
2010 May 03
7
rendering images dynamically
Hi, I have a rails application where I respond to a request by fetching image urls from various web api calls and need to display them as they come available. I am able to display all the images once I get them all, but that causes an unacceptable delay for my user. One approach I am trying is, from my controller, set an @image variable, and then pass in a block to the model that retrieves the
2010 Jun 23
2
CSV Upload Issue
CSV: http://pastie.org/1015772 Controller: http://pastie.org/1015773 Why is it that it''s only saving the record for "EFG5"? I''m obviously missing something. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
2012 Mar 22
6
rescuing ActiveRecord::RecordNotUnique: clever or ugly?
I have an ActiveRecord that has several foreign keys, where the foreign keys act as a single compound key that needs to be unique: class CreateRelations < ActiveRecord::Migration def change create_table :relations do |t| t.references :src, :null => false t.references :dst, :null => false end add_index :relations, [:src_id, :dst_id], :unique => true end end
2010 Jun 02
5
user routing versus admin routing strategies?
In an app where ordinary users are limited to viewing and editing their own "stuff", but someone with admin privs can view and edit anybody''s stuff, what''s the right strategy for routing? At first blush, I''d think that an ordinary user (e.g. with id 565) should see something like: http://example.com/mystuff.html ... where the controller assumes
2010 Sep 28
1
Run 'rails console' no problem, but not 'rails dbconsole': Couldn't find database client: psql.
It''s one of those things that seems like it should work but does not. My rails app (and ''rails console'') clearly knows where my data is as I can see my data. When I run ''rails dbconsole'' I can not get in, I get this error: Couldn''t find database client: psql. Check your $PATH and try again. Up to now I just log in to pgsql directly and I am
2010 Jan 28
5
files are missing in rails app
I''ve built the slackware packages of rails. rails path is: /frm/ruby/1.8.6/lib/ruby/site_ruby/1.8 RUBYLIB : /frm/ruby/1.8.6/lib/ruby/site_ruby/1.8:/frm/ruby/1.8.6/lib/ruby/site_ruby/1.8/i686-linux/ I could created the rails application, but files are missing. Config - boot.rb, database.yml, environment.rb and routes.rb Public -
2010 Jan 22
11
Finding out where a variable is defined
I''m looking at code in a project. I have no clue what is being passed into the resource parameter: def read_authorized?(resource) if resource.respond_to? :user_read_authorized? resource.user_read_authorized? current_user else true end end Is there any kind of debugging feature I can run to see what gets passed into resource in this specific
2011 Mar 07
2
obfuscating sensitive data
In our app, users give us sensitive information (credentials for logging into a third party site). At some point, we need those credentials in cleartext in order to access the third party site, but while they''re in our database, we want to make best effort for protecting them. What techniques have people used for this? I find myself asking "WWMD (What Would Mint.com Do?) -- any
2010 Nov 09
3
help getting started with javascript generated forms
How does one generate a form within a view using javascript? Specifically, assume views/premise/new.html.erb looks like this: <%= form_for(Premise.new) do |f| %> <%= f.hidden_field :full_address, :value => $FULL_ADDRESS %> <%= f.hidden_field :geocoding, :value => $GEOCODING %> <%= f.submit :value => "use this address" %> <%= f.label
2012 Apr 05
5
rspec: identical tests fails when repeated
I''m doing RSpec controller testing with CanCan authorization, and I''m seeing something I''ve never seen in RSpec before: the same test run twice fails on the second one. I am NOT doing before(:all) or other things that should cause state to persist between tests: Here''s the relevant code: context "POST create" do context "with user logged