I must have posted that before I had enough coffee this morning. The
correct answer to how many people tweet in french is:
Person.select('DISTINCT
people.id').joins(:tweets).merge(Tweet.where(:language_id = 3)).count
via @ffu_
--
Posted via http://www.ruby-forum.com/.
--
You received this
How many people tweet in French who speak English?
Person.select('DISTINCT
people.id').joins(:tweets).merge(Tweet.where(:language_id =
3)).where(:language_id = 1).count
(0.8ms) SELECT COUNT(DISTINCT people.id) FROM people INNER JOIN
tweets ON tweets.person_id = people.id WHERE
rake db:test:prepare loads your schema.rb (or dbstructure.sql) into your
test database. I don't think that's the problem.
Looking at the stack trace, I would guess that you still have some
fixture files for tables that you have deleted.
Sarah
--
Posted via http://www.ruby-forum.com/.
--
Ok, I figured out how many people tweet in french? ... I was missing a
join:
Person.joins(:tweets).where(:tweets = {:language_id = 'fr'}).count
(0.1ms) SELECT COUNT(*) FROM people INNER JOIN tweets ON
tweets.person_id = people.id WHERE tweets.language_id = 0
Sarah
p.s. Thomas -- thanks I
I have a real-world application with some complex queries that I want to
convert to Arel (as part of an upgrade to Rails 3.1). So that I can
understand what I'm doing before I flail around in my real app, I wrote
a little sample app (just the models) with some similar associations --
one table
I believe it is still ok to use RAILS_ENV as an environment variable
outside of Rails, but you want to use Rails.env in your code.
Sarah
http://www.ultrasaurus.com/
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups Ruby
on
We've just upgraded our Rails 2.0.2 app to 2.3 and the webservices
create APIs are failing. Instead of receiving parsed XML, the
controller's create method gets the whole xml as a hash key with the
value nil.
To isolate this issue, I generated a vanilla app:
$ rails scaffold_xml
$
Sarah Allen wrote:
To test my assumptions, I repeated the above steps with rails _2.0.2_
scaffold_xml_202 to look at it in the old version of rails (minus the
forgery bit which didn't used to be required.)
Note: in Rails 2.0.2 it does the exact same thing, so I must need to do
something
Frederick Cheung wrote:
I assume this is a typo and than in the real world you had remembered
the closing /project. Having done that you need to get curl to set
the content type appropriately.
I thought that posting to projects.xml would mean that setting the
content-type wasn't required
Frederick Cheung wrote:
I assume this is a typo and than in the real world you had remembered
the closing /project. Having done that you need to get curl to set
the content type appropriately.
Ah, so there must be a bug in my test. This works:
$ curl -X POST -d
Thanks for your help, Fred.
For future reference, I've written up a little cheat sheet with the
various curl commands to access the various default Rails XML APIs:
http://www.ultrasaurus.com/sarahblog/2009/06/simple-web-services-with-rails/
--
Posted via http://www.ruby-forum.com/.
Enzo Rivello wrote:
I just was wondering if out there exists some plugin that would permit
to rails to interact directly with the flash streaming server Red5 for
purpose of video collaboration!
There's the openlaszlo_plugin and rOpenLaszlo which will get you
half-way there. I'm also working
Salil Gaikwad wrote:
i try something like this in routes.rb
map.connect 'issues/:action', :controller = 'issues', :action='new'
and then restart the server but it doesn't works
Try this in irb
rts = ActionController::Routing::Routes
rts.recognize_path(issues/new)
and it'll return
Matt Jones wrote:
Take a careful look at the errtheblog article - you should be using
require, not gem here.
The gem statements only add the gem directories to the load_path.
Changing to 'require' got past that error. I still don't understand why
it failed to load since I had requires
I'm picking up a Rails app that is using a lot of older gems. We're
using Rails 2.0.2 and planning to move to to Rails 2.3 along with
upgrading the the dependencies. However, in the meantime, we're moving
servers around and adding new folks to the dev team, so I thought it
wise to freeze the
I'm new to Rails and I'm trying to understand the code created by
generate scaffold. I'm using Rails 2.2.2.
$ ./script/generate scaffold Task description:string
generated the following code in app/controller/tasks_controller.rb
class TasksController ApplicationController
# GET /tasks
#
Patrick Doyle wrote:
If you look in app/controllers/application.rb, you will find that
ApplicationController is a task that you derived from
ActionController::Base. You should be able to find documentation about
ActionController::Base at http://api.rubyonrails.org/
ah. This solves the
17 matches
Mail list logo