[Rails] Re: validates_uniqueness_of - how did I get two users?

2009-03-01 Thread Sarah Mei

In ActiveRecord::Base, the save method takes a flag called
perform_validation, which you can set to false. Check your controller
code to make sure someone didn't decide to skip the validations
somewhere.

On Sat, Feb 28, 2009 at 4:39 PM, phil p...@philsmy.com wrote:

 The odd thing is that the users were created through the website two
 months apart!

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: retrieve value from text_field and save it in another model

2009-02-26 Thread Sarah Mei

I'm not quite sure what you're after, but my guess is you want to
associate children and filtersetting objects. Have you set up an
association in the model files?

On Thu, Feb 26, 2009 at 2:04 AM, Swarna Priya
rails-mailing-l...@andreas-s.net wrote:
 I have two models Child.rb and Filtersetting.rb I have written the code
 for inserting into both models with many rows at the same time. It works
 fine. The issue is that I need the childname entered correspondingly by
 the user to be transferred to the Filtersetting table.
[...]
 The issue is I want to store the childname and childid in Filtersetting
 table. That is the first childname and childid corresponding to first
 one in Filtersetting table.

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: validation + should be 0

2009-02-26 Thread Sarah Mei

You could try making the default value nil. Makes more sense anyway -
nil indicates lack of data, while 0 suggests there is a default image.

On Thu, Feb 26, 2009 at 12:07 PM, Petan Cert
rails-mailing-l...@andreas-s.net wrote:
 my default value for variable mainimage_id is 0. I am trying to apply
 really basic validation. If mainimage_id is 0 it should fail and if it
 is  0 it should pass the validation.

 validates_numericality_of :mainimage_id, :greater_than = 1, :message =
 Choose image.

 This will pass the validation even if the value is 0.
 Thanks for your help.

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: controller and views

2009-02-25 Thread Sarah Mei

Check out the complex forms railscast.
http://railscasts.com/episodes/73-complex-forms-part-1

On Tue, Feb 24, 2009 at 11:22 PM, Nilesh Kulkarni
rails-mailing-l...@andreas-s.net wrote:
 I am writing an application in which i have list of books fetching from
 data base,i am using textbox to display that data from database .ie
 xyz hindi, are in textbox.
 i am displaying 100 record per page ,i want to use single save button
 that will save changes in all page  instead of for each recors (means if
 i change xyz(name) from first line and english(language) from second
 and clock on save button all changes must be saved in database)how can i
 do that?


 id name language  year
 1  xuz   hindi    2008
 2  sdd   english  1982
 .
 .
 .
 100 xde eng       2009
 __
 |save button|
 ---

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: validation on a has_many relationship

2009-02-25 Thread Sarah Mei

The only think I can think of is that you have a model variable named
@request, which is also, by default, the name of the HTTP request
object. There may be some weird overwriting going on.

Rename your model. It will save you huge headaches in the long run,
not least when trying to ask for help, since people will always assume
that @request refers to the HTTP request.

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Saving rich text to the database

2009-02-25 Thread Sarah Mei

Couple of questions: first, what happens if you copy and paste the
insert SQL into your database and run it (i.e., are you sure the SQL
works on your db)? Second, what is in your log after the NoMethodError
message?

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Simulating script/console for backend process

2009-02-25 Thread Sarah Mei

Generally, you want to put this sort of thing in a rake task (instead
of a script) and then your cron is just
cd /application_rails_directory; rake do_my_thing --RAILS_ENV=production

 On Wed, Feb 25, 2009 at 12:57 PM, Duane Morin
 rails-mailing-l...@andreas-s.net wrote:

 I could swear I've seen instructions before on how to do this, but I
 can't find them.  I've got a backend process that runs in the same
 environment as my webapp, injecting data into the model. In the
 interests of not repeating myself I'd like to take advantage of the
 app/models from my webapp as well as my config/database.yml information.

 Normally when running the script by hand I'd go into script/console and
 just do a 'require' on it.  This has served me quite nicely, actually.

 But I've got to put this into a cron job and take the people out of the
 loop.  Is there a right way to do that, and simulate all those
 assumptions that the console has to make before running my script?  As
 far as I can figure the console app does not have a standard start up,
 run X script and then exit option.  I suppose I can just string
 together all the necessary requires at the top of my script, manually
 including the model files I need and such.  I'm just trying to figure
 out if there's a better/cleaner way already out there.

 [This feels like a FAQ and trust me, I'm googling as best I can and just
 not finding it!  I hate asking when I feel like I should know the
 answer...]

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: validation on a has_many relationship

2009-02-24 Thread Sarah Mei

You need to get the contact's errors from the contact. Try this out:

  @request = Request.new(params[:request])
  @request.contacts  contact = Contact.new(params[:contact]
  if @request.save
# everything's fine
  else
flash[:error] = @request.errors.full_messages.join(', ') +
contact.errors.full_messages.join(', ')
  end

On Mon, Feb 23, 2009 at 9:28 PM, Sijo Kg
rails-mailing-l...@andreas-s.net wrote:

 Hi
    That is correct I get the same result when use
 @request.errors.each{}
      But my problem is when email and name blank,  I dont get the error
 message flash as

 Name should not be blank
 Email should not be blank

   but I get error like

     contacts is invalid

   But if suppose my request model too has a validation like
 validates_presence_of :reason, :message = 'Reason should not be blank'

     I get the whole flash[error] like

   Reason should not be blank
   contacts is invalid

      Why the individual error messages of contact model not appearing?

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Multiple models one form and a one-to-one relationship

2009-02-24 Thread Sarah Mei

In a has_one/belongs_to association, I don't think you need the user=
method. What happens if you take it out completely?

On Tue, Feb 24, 2009 at 1:27 PM, Stefan Frede sfr...@gmail.com wrote:

 Hi!

 I've got a not so unfamiliar multiple models in one form problem. Due
 to the complex forms railscast I've got it up and running for a one-to-
 many relationship but now I have a one-to-one relationship and I
 didn't get it done.

 Here is my code, perhaps someone can take a look and give me a hint
 what's wrong. I put what is going wrong into the code where I think it
 is belonging to. And I don't know if it matters but I'm running Rails
 2.1.1.

 ##
 # Model

 class Subscription  ActiveRecord::Base
  belongs_to :user

  def user=(attributes)
    ##
    # !!! Here is something wrong
    # - I get a Hash with all my fields here
    # - attributes belongs to class HashWithIndifferentAccess
    # - Whith self I get the error „undefined method
 `stringify_keys!'...“
    # - Without self the subscription model is saved without the user
 model

    self.build_user(attributes)
  end
 end

 class Subscription  ActiveRecord::Base
  has_one :subscription
 end

 ##
 # Controller

 class SubscriptionsController  ApplicationController
  def new
   �...@subscription = Subscription.new
   �...@subscription.build_user

    respond_to do |wants|
      wants.html
      wants.xml  { render :xml = @subscription }
    end
  end

  def create
   �...@subscription = Subscription.new(params[:subscription])

    respond_to do |wants|
      if @subscription.save
        flash[:notice] = 'Subscription was successfully created.'
        wants.html { redirect_to root_url }
        wants.xml  { render :xml = @subscription, :status
 = :created, :location = @payment }
      else
        wants.html { render :action = new }
        wants.xml  { render :xml = @subscription.errors, :status
 = :unprocessable_entity }
      end
    end
  end
 end

 ##
 # View (Haml syntax)

 - form_for :subscription, @subscription, :url = subscriptions_path do
 |subscription_form|

  ... subscription fields

  - subscription_form.fields_for :user do |user_form|

    ... user fields

 Every help is appreciated. Thanks in advance.

 Regards,
 Stefan
 


--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: best way to model user or IP

2009-02-23 Thread Sarah Mei

Create a single row in the user table to represent the anonymous user,
and associate the IP address with the edit instead of with the user.
That way you don't clutter your database with anonymous users but you
still retain the IP for each edit.

On Mon, Feb 23, 2009 at 8:00 AM, Daniel Choi dhc...@gmail.com wrote:

 I forgot to mention the requirement that if an anonymous visitor edits
 a page, their IP address is recorded.

 On Feb 23, 10:58 am, Daniel Choi dhc...@gmail.com wrote:
 I'm writing a wiki-based website from scratch and would like some
 suggestions on the best way to deal with this common situation. A page
 can be edited by a logged-in and registered user or by an anonymous
 visitor. If a user edits the page, the model object representing the
 edit is associated with a user via a user_id foreign key. But if an
 anonymous visitor can edit the page too, what's the best way to model
 this?

 One idea I'm entertaining is to make a polymorphic relationship
 between the edit or page version and two different classes: a User
 class and an AnonymousVisitor class. But I'm not sure.

 Thanks in advance for your tips and suggestions.

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: activemerchant + activesupport install/dependency issues

2009-02-23 Thread Sarah Mei

activemerchant requires activesupport = 2.0.0, and that's being loaded ok.

Then some other gem is requiring activesupport 1.4.1, but since 2.1.0
is already loaded it can't load 1.4.1.

You should run gem cleanup to remove old versions of activesupport. If
that doesn't fix it, you'll need to locate the gem that's requiring
the older version and try modifying it to take the newer version.

On Mon, Feb 23, 2009 at 1:31 AM, will@gmail.com will@gmail.com wrote:

 Hi all:

 Saw the awesome railscasts episode on activemerchant and am going to
 give it a try, but keep running into this install problem that I can't
 figure out:  after installing activemerchant as a gem, my rake keep
 aborting with this error:

 /Library/Ruby/Site/1.8/rubygems.rb:149:in `activate': can't activate
 activesupport (= 1.4.1, runtime), already activated
 activesupport-2.1.0 (Gem::Exception)

 I've tried uninstalling all the gems and reinstalling, installing
 activemerchant 1.4.0 to no avail.  No info that I can find on this
 error that I can find either.  Help would be much appreciated!

 BTW, not sure if this trace from rake gems:install with trace is more
 useful:

 william$ sudo rake gems:install --trace
 (in /Users/william/Code/lolligift/trunk)
 ** Invoke gems:install (first_time)
 ** Invoke gems:base (first_time)
 ** Execute gems:base
 ** Invoke environment (first_time)
 ** Execute environment

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: geokit - using :through to connect models

2009-02-23 Thread Sarah Mei

I think your trouble here is with the polymorphic association. (Why do
you need it - is there another model that has_one or has_many
:internships :as = :employer?)

Try either removing :polymorphic = true if you don't need it, or
adding :as = :employer to the Employer's has_many :internships line.

http://wiki.rubyonrails.org/rails/pages/UnderstandingPolymorphicAssociations

On Sun, Feb 22, 2009 at 11:12 PM, Sergio Ruiz
rails-mailing-l...@andreas-s.net wrote:
 i am currently trying to use :through to attach two of my models
 together using geokit. for some reason, i am running into a problem:

 ArgumentError: Unknown key(s): as

 i have two models, one that is geocoded, and one that belongs to that
 model. the models look like:

 ,[ employer.rb ]
 | class Employer  ActiveRecord::Base
 |   acts_as_mappable
 |   before_validation_on_create :geocode_address
 |
 |   has_many :internships
 |   belongs_to :account
 |   belongs_to :role
 |
 |  private
 |   def geocode_address
 | geo=GeoKit::Geocoders::MultiGeocoder.geocode(address1 +   + city +  
  + state +   + zip)
 | errors.add(:address, Could not Geocode address) if !geo.success
 | self.lat, self.lng = geo.lat,geo.lng if geo.success
 |   end
 |
 | end
 `

 and an internship:

 ,[ internship.rb ]
 | class Internship  ActiveRecord::Base
 |   has_many :internship_categories
 |   belongs_to :employer, :polymorphic = true
 |   acts_as_mappable :through = :employer
 | end
 `

 it seems like there is an intermediary object in the docuements called
 ':locatable' that connects the the two together, but i just can't get
 how that is being called, or what i am supposed to do with it.

 no matter where i put it, i end up with this error:

 ArgumentError: Unknown key(s): as

 if i remove: :as = :locatable i end up with a problem in that the
 model doesn't have :lat or :lng, which makes me think that
 the :through is not working at all.

 please let me know how to attack this..

 thanks!
 --

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Ruby1.9.1 Bus Error

2009-02-23 Thread Sarah Mei

http://redmine.ruby-lang.org/issues/show/1080
http://redmine.ruby-lang.org/issues/show/1142

Ruby 1.8.7 is more stable.

On Mon, Feb 23, 2009 at 12:50 PM, Rick richard.t.ll...@gmail.com wrote:

 More info:

 In rails (2.3.0) generated test app

 1) Ran script/server and default WEBrick started and functioned fine
 at least through the rails provided index.html.
 2) Halted script/server
 3) Ran script/server thin and produced the reported bus error
 4) Ran script/server and default WEBrick now produces the reported bus
 error.

 This is looking less like a Thin problem...

 On Feb 23, 9:38 am, Rick richard.t.ll...@gmail.com wrote:
 I have also posted this message to the Thin talk group as it's not
 clear to me whether this is a ruby or a thin problem.

 I have both installed thin via gem install and downloaded and built/
 installed from source.  I have run thin via script/server thin as
 indicated here and via thin start.  In all cases I get the same
 result.

 On Feb 22, 10:37 pm, Rick richard.t.ll...@gmail.com wrote:

  Here's my particulars:

  Mac OS X 10.5.6
  1.25 GHz PPC G4

  /test 726  script/about
  /opt/local/lib/ruby/gems/1.9.1/gems/actionpack-2.3.0/lib/
  action_controller/routing/segments.rb:6: warning: encoding option is
  ignored - N
  About your application's environment
  Ruby version  1.9.1 (powerpc-darwin9.6.0)
  RubyGems version  1.3.1
  Rails version 2.3.0
  Active Record version 2.3.0
  Action Pack version   2.3.0
  Active Resource version   2.3.0
  Action Mailer version 2.3.0
  Active Support version2.3.0
  Application root  /Users/rick/test
  Environment   development
  Database adapter  sqlite3
  Database schema version   0

  /test 727  gem list thin

  *** LOCAL GEMS ***

  thin (1.0.0)

  /test 728  script/server thin
  = Booting Thin
  = Rails 2.3.0 application starting onhttp://0.0.0.0:3000
  /opt/local/lib/ruby/1.9.1/openssl/ssl.rb:31: [BUG] Bus Error
  ruby 1.9.1 (2008-10-28 revision 19983) [powerpc-darwin9.6.0]
[...]

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: How to set up fixtures to use ActiveRecord callbacks?

2009-02-23 Thread Sarah Mei

I've found the easiest way to do this is to put hashed passwords in
the fixtures, i.e.

user_1:
  id: 1
  email: u...@mysite.com.test
  password: ae135e826bbd76cf593d8db38c02ed2e134e159f #test

On Mon, Feb 23, 2009 at 1:52 PM, Michael J. I. Jackson
mjijack...@gmail.com wrote:

 Hi all,

 I have a rake task that is seeding my database. This is so I can drop
 and recreate the entire database and then add some company accounts
 very easily. My rake file (lib/tasks/database.rake) looks like this:

 namespace :db do
   desc Load seed fixtures (from db/fixture) into the current
 environment's database.
   task :seed = :environment do
 require 'active_record/fixtures'
 Dir.glob(RAILS_ROOT + '/db/fixture/*.yml').each do |file|
   Fixtures.create_fixtures('db/fixture', File.basename(file, '.*'))
 end
   end
 end

 Basically, it's just looking through db/fixture for any fixture files
 to load into the database. As mentioned previously, I'd like to use
 the fixture to create some user accounts. However, in my account
 model, I have a before_save callback that is responsible for creating
 hashes of user's passwords before they are saved out to the database.
 Is there any way to do either make the rake task respect the
 ActiveRecord callbacks or somehow add the hashing logic directly to
 the task?

 Thanks in advance,

 Michael J. I. Jackson
 mjijack...@gmail.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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: XMLRPC calling question

2009-02-23 Thread Sarah Mei

erb. Set up a boilerplate file and fill in what you need. It's MUCH
faster than trying to generate it with REXML.

On Mon, Feb 23, 2009 at 6:57 PM, Don French dhf0...@gmail.com wrote:

 I have a mashup I need to d with a site that uses xmlrpc. I am trying
 to understand the the call method.  I have the following items that
 need to be passed to the remote site.

 methodName
 and the following structure
   ID - string
   area - string
   views = array of strings

 I know what the xml should look like
[...lots of xml...]

 I have results from various inputs from the view for the value. I am
 trying to figure out how to create the xml structure and how to use it
 in the XMLRPC call.

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: validation on a has_many relationship

2009-02-23 Thread Sarah Mei

flash[:error] = @request.errors.full_messages.join(', ')

On Fri, Feb 20, 2009 at 2:05 AM, Sijo Kg
rails-mailing-l...@andreas-s.net wrote:

        But here my problem is I expected
       'Name should not be blank' 'email should not be blank'

     But what I got is
    contacts is invalid

           Why this Please help me to get the errors as I expected

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: How do I access a variable defined in application.rb from within application.rhtml?

2009-02-22 Thread Sarah Mei

For actual read-only data that is an instance of a model class, I'd
set up a class method instead. So for a default location, in
Location.rb,

def self.default_location
  @@default_location ||= Location.find_by_name(San Francisco)
end

This fixes your migration problem, doesn't reload it with every page,
and also works with testing.

On Sun, Feb 22, 2009 at 4:24 PM, Jeff Lewis jeff.bu...@gmail.com wrote:
[...]
 If var that you're setting really is global in scope, intended to be
 shared by all users' requests and is read-only, then you could store
 it in a global var:
[...]

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: sorting by subsidiary class

2009-02-22 Thread Sarah Mei

@category = Category.find(params[:id])
@services=Service.find(:all, :order = XXX, :conditions =
 ['category_id = ?', @category.id])

@category = Category.find(params[:id])
@category.services.sort! { |x, y| x.reduction = y.reduction }

--~--~-~--~~~---~--~~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---