I want to create a Rails (2.1 and 2.2) model with ActiveRecord validations, but without a database table. What is the most widely used approach? I've found some plugins that claim to offer this functionality, but many of them don't appear to be widely used or maintained. What does the community recommend I do? Right now I am leaning ...
In the admin section of a website i am building i would like to put together a dashboard page, or 'quick look' type page where the most recent changes/additions/etc in several different areas can be viewed.
I was thinking the best way to do this would be to use partials and have each partial contain the markup for the data i need to dis...
how do i define a named_scope to return all the records that were created within the last 7 days, and then how do i use that named scope in a controller?
...
I have two models (users and courses) and a JOIN table that allows enrollments in the course:
class User < ActiveRecord::Base
has_many :enrollments, :dependent => :destroy
has_many :courses, :through => :enrollments
end
class Course < ActiveRecord::Base
has_many :enrollments, :dependent => :destroy
has_many :users, :throu...
Is there a way to get drop_receiving_element to not generate "// ..
...
I have config.time_zone in environment.rb set to "UTC", and my mySQL server returns the current time in my local time zone when I issue "select now();" and in utc when I ask for "select utc_timestamp;"
I'm running rails 2.1.2, the mysql gem 2.7.3, activerecord gem 2.1.2, and mysql --version returns "Ver 14.12 Distrib 5.0.27 for Win32 (i...
I posted a question earlier today when I'd not zeroed in quite so far on the problem. I'll be able to be more concise here.
I'm running RoR 2.1.2, on Windows, with MySQL. The SQL server's native time zone is UTC. My local timezone is Pacific (-0800)
I have a model with a :timestamp type column which I can do things like this with:
...
In Ruby on Rails, how to add foreign key constraint in migration?
...
Where can I download the rails migration file for country, state and city table
...
Hello
I'm starting my adventure with Ruby on Rails and as IDE I choose Netbeans. It has bundled server Webrick and it had worked good. But after some changes in my first application it gives me internal error 500 - but nothing shows in console. And older actions give the same result.
How can I find where the problem is?
I work on Ubuntu...
Hi,
I have a following SQL QUERY:
SELECT articles.name, articles.price, users.zipcode FROM articles INNER JOIN users ON users.id = articles.user_id WHERE vectors @@ to_tsquery('crime') ORDER BY articles.price ASC
And I Would like to write it inside of a find method from an ActiveRecord Class named Articles (Articles belongs_to user). B...
I have never heard about this language until I came to this site, why is it so famous?
Could you post some example sites developed in this technology?
Easy with the downvotes please, am nub I know :(
Thanks
...
>rails -v
Rails 1.2.6
>ruby -v
ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]
When I run a test fixture (that tests a rails model class) like this, it takes 20-30 secs to start executing these tests (show the "Loaded suite..."). What gives?
>ruby test\unit\category_test.rb
require File.dirname(__FILE__) + '/../test_helper'
cla...
It seems like due to the threading issue logger.warn (thats what I tested) doesn't generate any output? my code is similar to this:
def deliver(args)
logger.info "delivery start"
thread_pool.defer(:deliver_deferred, args)
logger.info "delivery end"
end
def deliver_deferred(args)
logger.warn "whatsoever"
end
Any idea?
...
This is a Rails/ActiveRecord question.
I have a model which basically has to represent events or performances. Each event has many attributions: an attribution is basically something like "In this event, Person X had Role Y".
I concluded that the best way to allow a user to edit this data is by providing a free text field which expects...
Hi, i'm trying to use the GeoKit plugin to calculate the distance between 2 points. So the idea is, i do a search for an article, and the results i want to order by distance. So i have a form where I enter the article (that im looking for) and my address. Then rails must find all articles that match with my query and order by address.
S...
I'm looking at building a Rails application which will have some pretty
large tables with upwards of 500 million rows. To keep things snappy
I'm currently looking into how a large table can be split to more
manageable chunks. I see that as of MySQL 5.1 there is a partitioning
option and that's a possible option but I don't like the wa...
I'd like to use visitor IP addresses into a company name. This will be used for displaying something like "Hello visitor from Apple Inc." . Note I am looking for the company name, not the domain name. Extra points for determining the originating country. The app is written in Ruby on Rails, but examples in other languages will do. Thanks...
% rails
...
General Options:
...
-c, --svn Modify files with subversion. (Note: svn must be in path)
-g, --git Modify files with git. (Note: git must be in path)
What do these "Modify files" options do for me?
Edit: It is unclear to me what using one (or both?) of these options actually do...
I'm trying to verify that a parameter is an instance of a specific class in Rails:
def schedule(action, *args)
if arg.is_a? Aircraft
...
end
end
I'm doing this in a library class (the file is in lib/) and I get an uninitialized constant Aircraft error. Aircraft is a model class, with a corresponding aircraft.rb file in app/mod...