Ok,

thanks for your help.

so I'm trying to get one of the values out of 'params' before updating 
the record, and then use the value of the param to change other params 
before saving the record.

    # the record I'm saving
    @event = Event.find(params[:id])

    # look at different model called venue to see if there are any with 
the same name
    @venue = (Venue.where(:venueName => @event.venue))[0]

  # if there are venues of the same name as the event I'm trying to 
save, copy longitude and latitude values from venue to event.
  if @venue
  @event.update_attributes(:city_location => @venue.city_location)
  @event.update_attributes(:longitude => @venue.longitude)
  @event.update_attributes(:latitude => @venue.latitude)
  end

  #save the event
  if @event.update_attributes(params[:suggested_event])


If I say that the event is at a venue called 'Warehouse 54', I want to 
go and search all my saved venues looking for 'venue 54', and then 
filling in other values in the 'event' according to what saved for that 
venue.

"Either params doesn't contain what you think it is and so the call to
update_attributes doesn't do anything,"
Params doesn't contain what I want it to - it's not going and filling in 
the other values

Any advice on how to look at, and alter the params being updated before 
they're updated?

Thanks

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

Reply via email to