[Rails] Using Value Length in Validation Message

2009-05-17 Thread phil7085
I am learning to use Validations and am using validates_length_of to check a field value is no longer than 240 characters. I want to be able to produce a message back to the user telling them that the value they entered was x characters too long. Does anyone know how I can work with the value

[Rails] Re: Using Value Length in Validation Message

2009-05-17 Thread phil7085
Thanks for the reply, That doesn't give me the value for name it just gives back the name of the model. i.e Task so the length given is 4. Any ideas? On May 17, 10:43 am, Colin Law clan...@googlemail.com wrote: :message = Length is #{name.length}, max allowed is 240 2009/5/17 phil7085 p

[Rails] Re: Using Value Length in Validation Message

2009-05-17 Thread phil7085
Yep that works, not quite sure why i couldn't access the length before though, still abit over my head but i'm learning. Thanks for your help guys. P On May 17, 2:06 pm, Colin Law clan...@googlemail.com wrote: 2009/5/17 phil7085 philip.ben...@pixelblur-uk.com Thanks for the reply

[Rails] Re: Ajax in Rails

2009-03-02 Thread phil7085
= 'advert', :object = @advert And in my partial I have tried both if these: %= advert.title % %= @advert.title % No luck. Any suggestions? Phil On Mar 1, 8:59 pm, phil7085 p@btopenworld.com wrote: Thanks, I will give this a try, although as a newbie this talk of :locals, :object

[Rails] Re: Ajax in Rails

2009-03-02 Thread phil7085
Ok I've got it to work by using this in my partial: %= @advert[:title] % Can you tell me why I have to reference like this? Phil On Mar 2, 8:22 am, phil7085 p@btopenworld.com wrote: Hi guys, I've tried both of those options and can't get it to work, I think it's the way I am trying

[Rails] Re: Ajax in Rails

2009-03-02 Thread phil7085
of the class. Now in my partial I can use @advert.title and all works fine. Thanks for all your help. Phil On Mar 2, 9:13 am, Frederick Cheung frederick.che...@gmail.com wrote: On Mar 2, 8:39 am, phil7085 p@btopenworld.com wrote: Ok I've got it to work by using this in my partial

[Rails] Ajax in Rails

2009-03-01 Thread phil7085
Hi All, New to the group, and new to learning rails. I'm having some trouble, i've done a few tutorials on creating some small apps with rails and am now starting to play around myself. I've been trying to create a simple form which when a user enters any data that data is displayed as a

[Rails] Re: Ajax in Rails

2009-03-01 Thread phil7085
So then do I need to use the controller to populate another @advert object with all the params then render the partial? Cheers, Phil On Mar 1, 5:00 pm, Frederick Cheung frederick.che...@gmail.com wrote: On Mar 1, 1:04 pm, phil7085 p@btopenworld.com wrote: I've been trying to create

[Rails] Re: Ajax in Rails

2009-03-01 Thread phil7085
this: def preview @advert = Advert.new(params[:advert]) render :partial = 'advert' end Phil On Mar 1, 7:31 pm, Frederick Cheung frederick.che...@gmail.com wrote: On Mar 1, 5:10 pm, phil7085 p@btopenworld.com wrote: So then do I need to use the controller to populate another @advert object

[Rails] Re: Ajax in Rails

2009-03-01 Thread phil7085
Thanks Fred, How would I then need to tell rails to use the @advert object because that's the part that I have been having trouble with? Phil On Mar 1, 7:41 pm, Frederick Cheung frederick.che...@gmail.com wrote: On Mar 1, 7:38 pm, phil7085 p@btopenworld.com wrote: I am simply trying

[Rails] Re: Ajax in Rails

2009-03-01 Thread phil7085
Thanks, I will give this a try, although as a newbie this talk of :locals, :object, etc has slightly gone over my head. I'm sure i'll get it. Phil On Mar 1, 8:37 pm, Phlip phlip2...@gmail.com wrote: phil7085 wrote: How would I then need to tell rails to use the @advert object because