I'm fairly new to Ruby (around 6 months) and to RoR (about two or three
weeks of practical experience). However, for an important programming
project, I'm (for economical reasons) stuck serving my app on a hosted
web server which uses Ruby 1.8.7 and Rails 2.3.10. But I want to be
using Ruby 1.9 and
Forgive this question, but I'm new to rails, and my SQL is rather rusty.
I have a line like so to get all records for a particular time period:
@recordings_for_period = Recording.find(:all, :order => "date_of_event
DESC", :conditions => ["date_of_event >= ? AND date_of_event < ?",
start_date, end_
Terry Michaels wrote:
> Terry Michaels wrote:
>> # cat app/models/recording.rb
>> class Recording < ActiveRecord::Base
>> validate :title, :speaker, :date_of_event, :file, :presence => true
>> validate :title, :file, :uniqueness => true
>> end
>
Terry Michaels wrote:
> # cat app/models/recording.rb
> class Recording < ActiveRecord::Base
> validate :title, :speaker, :date_of_event, :file, :presence => true
> validate :title, :file, :uniqueness => true
> end
Wait, double checked the book... the method is su
Colin Law wrote:
> On 17 August 2010 06:31, Gintautas Å imkus wrote:
>> Try to save the object first and then check for validity.
>
> I don't think that is right, for a start it will not save if it is
> invalid.
>
> Colin
The point of the unit test is make sure the object /is/ invalid. That
is
Still following my rails book (more like, adapting to my project as I
go). My first attempt at a unit test failed. Adapting the example in the
book, I came up with this:
require 'test_helper'
class RecordingTest < ActiveSupport::TestCase
test "record attributes must not be empty" do
recordi
6 matches
Mail list logo