[Rails] Getting the top results only by group in a .find statement

2009-04-09 Thread tyliong
This is my table model name is bids id | bid | keyword 1 | 2 | orange 2 | 3 | orange 3 | 1 | red 4 | 3 | blue 5 | 6 | red what i want is the get these the top bidder of each unique keyword in one .find statement --~--~-~--~~~---~--~~ You

[Rails] how to save one value into the attributes of all rows in a model

2009-04-09 Thread tyliong
When i use Model.all and i want to save this one value into all the rows of the model how do i do it without using a for loop. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to

[Rails] /lib daemon folder: how do i add a module into the daemon?

2009-04-07 Thread tyliong
I am using the daemons plugin. I have just one problem how do i add modules from the /lib folder to the /lib/daemons/daemon.rb file eg. /lib/basic_functions.rb this is the file i want to load in daemon.rb contents daemon.rb: #!/usr/bin/env ruby # You might want to change this ENV[RAILS_ENV]

[Rails] SMTP settings for action mailer

2009-01-08 Thread tyliong
with rails 2.2.2 action mailer requires a valid ssl certificate i have a question about routing my smtp settings for my postfix are now ActionMailer::Base.smtp_settings = { :address = smtp.mydomain.com, :port = 25, :domain = mydomain.com, :authentication = :plain, :user_name =

[Rails] Actionmailer and postfix settings

2009-01-07 Thread tyliong
Hi, I am having problems configuring my actionmailer to work with postfix. I followed this tutorial: http://howtoforge.org/virtual-users-and-domains-postfix-courier-mysql-centos5.1 and i got the server set up. at first i fixed the mail settings to work with gmail using this tutorial:

[Rails] serializing active record objects do not save after first slice

2008-12-18 Thread tyliong
Hi, i am having a very weird problem i have an array Model: serialize :marketarray Controller @marketobject = Market.find(1) @marketobject.marketarray = [red,blue,green] I do this @marketobject.marketarray.slice!(0) @marketobject.save! but it does not change the Market.marketarray to

[Rails] select_tag and select_date how to change inline font

2008-12-12 Thread tyliong
I have been trying to change the font size in the select_date but i haven't had any luck here's what i did: %= select_date( Date.today, :prefix = 'prom_date_end', :order = [ :day,:month, :year], :html = {:style = font-size: xx-small;}) % --~--~-~--~~~---~--~~ You

[Rails] Active record :find having an if statement inside the conditions

2008-12-09 Thread tyliong
Hi, i was just wondering if its is possible to put a if statment inside the find conditions for example: grovery_price = model.find(:first, :conditions = [ if x = ? then y must = ?, 200, 300] I have been googling for some time for a solution to this but i just can't seem to find any.

[Rails] Validation errrors: how to get rid of Validation failed: and the Objects in them

2008-12-09 Thread tyliong
Hi when ever i do rescue Exception = e flash[:error] = e.message the e.message will always contain the Validation error: string and the Object Example: Validation failed: Price message:, Price message How do i tell rails that I just want the message? and not

[Rails] Find active record condition of not equal

2008-12-07 Thread tyliong
Hi, I have tried creating a not equal condition in the find statment but it just outputs an empty array. model.find(:first, :conditions = [ id = ? AND market = ? AND promotion ? , id , name, y],:order = 'id desc').price I have tried != instead of I have tried googling for the answer but i

[Rails] Ajax on failure message

2008-11-14 Thread tyliong
How do i change the ajax failure message % remote_form_for(:comment, :url = grocery_comments_path(params [:id]), :html = { :id = 'new_comment_form' }, :method = :post, :update = { :failure = error }) do |form| % the :update = { :failure = error } gives me the usual error messages

[Rails] form.text_area, how do you empty its contents?

2008-10-31 Thread tyliong
Hi, after i click submit and refresh the parital(with page.replace_html) with the remote_form_for, the %= form.text_area :body, :rows = 10, :cols = 40 % still contains the previous text. how do i totally remove the text inside of it? --~--~-~--~~~---~--~~ You

[Rails] Re: form.text_area, how do you empty its contents?

2008-10-31 Thread tyliong
Never mind i got it @comment.body = before the page.replace On Nov 1, 1:34 am, tyliong [EMAIL PROTECTED] wrote: Hi, after i click submit and refresh the parital(with page.replace_html) with the remote_form_for, the %= form.text_area :body, :rows = 10, :cols = 40 % still contains

[Rails] Passing a function with arguments to another function with arguments that is a loop

2008-10-28 Thread tyliong
Hi, I am a noobie. I just want to know what is the standard or most effective way of doing this I have two functions def display_price(grocery,batch) grocery_price = grocery.send(batch).price if grocery_price

[Rails] Re: protect_from_forgery :only = [:create, :delete, :update] what does this do exactly?

2008-10-07 Thread tyliong
. On Aug 27, 9:12 am, tyliong [EMAIL PROTECTED] wrote: protect_from_forgery :only = [:create, :delete, :update] Questions: (1)why do i need to put it in when i get an authenticate token error from passing an :id from the controller through AJAX? (2)are there any disadvantages

[Rails] Need help with AJAX partial not refreshing browser asking to save .js instead

2008-09-23 Thread tyliong
Hi, when i use the updatepassword action, it does not refresh the ajax partial but forces the browser to save a file why does that happen? def updatepassword @user = current_user return unless request.post? if User.authenticate(current_user.login, params[:old_password])