[Rails] Re: Regular expression: How do I allow forward slashes?

2009-12-19 Thread AlwaysCharging
But that made me question why I couldn't just put the "/" inside of the bracket as well. Like why did that have to be escaped if the period didn't. (I guess it's because in that syntax, the forward slash has closure properties.) Oh well it's working now, and I escaped the . as well (\.). Thank yo

Re: [Rails] Re: Regular expression: How do I allow forward slashes?

2009-12-19 Thread maryam kamali
hello iam maryam ihave peroblem ishal go aftenon by On Sat, Dec 19, 2009 at 11:21 AM, ralu wrote: > > > On Dec 18, 11:01 pm, AlwaysCharging wrote: > > In my app, I allow users to submit urls. They (of course) need the > > ability to submit urls with a forward slash, "/", but whats the > > regu

[Rails] Re: Regular expression: How do I allow forward slashes?

2009-12-19 Thread frogstarr78
It actually depends on where the "." is in the Regexp. In your case it is inside a Character Class "[]". So it is matching the "." character explicitly. Since \w is shorthand for the [a-zA-Z] character class. It is parsed as a character class instead of an escaped "w" character. So you could actual

[Rails] Re: What's the "update" equivalent to the "build" method?

2009-12-19 Thread AlwaysCharging
This is perfect! Thank you Emery. I was thinking the same thing, but was trying before_save filters and couldn't get it to work for the Update action. Honestly, I didn't even know about the before_validation helper, guess I got some more learnin' to do. Thanks again. And @Rick, thank you for the

Re: [Rails] Re: TinyMCE v. FCKeditor v. others

2009-12-19 Thread Peter De Berdt
On 19 Dec 2009, at 16:15, Jakub wrote: > I am quite happy with TinyMCE and there is a Rails plugin that > simplifies the usage. If you use ActiveScaffold, it has a bridge that > you can use and have TinyMCE editing in practicly no time. The file > upload is AFAIK supported by a plugin fork > > ht

[Rails] Re: What's the "update" equivalent to the "build" method?

2009-12-19 Thread Emery Finkelstein
Seems like the perfect place for a call back if you're doing this without discriminating. class Comment < ActiveRecord::Base ... before_validation :trim_blog_comment protected def block_comment self.blog_comment = blog_comment[0..140] if blog_comment.length > 140 end end Now it's

Re: [Rails] What's the "update" equivalent to the "build" method?

2009-12-19 Thread Rick DeNatale
On Sat, Dec 19, 2009 at 3:20 PM, AlwaysCharging wrote: > Currently I'm using .build in my Create action so that I have a little > more control before it gets saved.  For instance, I have: >   �...@comment = current_user.comments.build(params[:comment]) >     �...@comment.blog_comment = @comment.bl

[Rails] Re: Cant install any gems on windows

2009-12-19 Thread giorgio
I have solved it finally. After doing a gem update --system it works fine... -- 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-t...@googlegroups.com. To unsubscribe from this group, send em

Re: [Rails] Re: big time help(any idea for a proper title..)

2009-12-19 Thread Rick DeNatale
On Sat, Dec 19, 2009 at 1:12 PM, radu puspana wrote: > thx a lot rick, for taking you time to answer to my problem > yeah, it was a typo it was line_items, instead of list_items. > but...still don'tget something, i'm a rails noob what would you > expect :( > > what does rails exactly do when you w

[Rails] What's the "update" equivalent to the "build" method?

2009-12-19 Thread AlwaysCharging
Currently I'm using .build in my Create action so that I have a little more control before it gets saved. For instance, I have: @comment = current_user.comments.build(params[:comment]) @comment.blog_comment = @comment.blog_comment[0...140] to chop the blog_comment off at 140 characters.

[Rails] Re: schema dump to schema.rb not happening after migration

2009-12-19 Thread Todd
On Dec 17, 2:55 pm, Josh wrote: > We recently upgraded from 2.0.old to 2.3.5. > > Now when we run migrations schema.rb is not getting automatically > updated. (the migrations do work though) > > db:schema:dump seems correctly dump the schema and update schema.rb > > Any suggestions on where to s

Re: [Rails] Slideshow

2009-12-19 Thread bill walton
Hi Doug, On Sat, 2009-12-19 at 10:13 -0800, doug wrote: > It appears that the question, "How do I create a slide show" has been > asked many times in a variety of ways in this group. Reference has > been made to the O'Reilly book, "Ajax on Rails". Maybe I need to read > that. In any event, I d

[Rails] Re: Cant install any gems on windows

2009-12-19 Thread giorgio
Yes I am doing it from a "ruby console" from within instant rails. Still not had any joy. G. -- 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-t...@googlegroups.com. To unsubscribe from thi

[Rails] Slideshow

2009-12-19 Thread doug
It appears that the question, "How do I create a slide show" has been asked many times in a variety of ways in this group. Reference has been made to the O'Reilly book, "Ajax on Rails". Maybe I need to read that. In any event, I don't want to get into a long discussion of the broad issues relati

[Rails] Re: Regular expression: How do I allow forward slashes?

2009-12-19 Thread AlwaysCharging
Yes, that did it. Thank you. No idea how I try everything and overlook the simplest solution, duh. And, Thank you to everyone else that weighed in as well, definitely some other options to look into. Side note: Anybody know why the period doesn't have to be escaped? Like just "." allows the dot

[Rails] Re: big time help(any idea for a proper title..)

2009-12-19 Thread radu puspana
thx a lot rick, for taking you time to answer to my problem yeah, it was a typo it was line_items, instead of list_items. but...still don'tget something, i'm a rails noob what would you expect :( what does rails exactly do when you write li.product = cart_item.product ??? and wouldn't it be more

[Rails] Re: I can't PUT or DELETE JSON, where do I look?

2009-12-19 Thread joost
You are running into this because of a bug/misfeature. See this lighthouse ticket: https://rails.lighthouseapp.com/projects/8994/tickets/2289-_methodput-ignored-for-xhr-and-xml-requests Apparently you can set an HTTP_X_HTTP_METHOD_OVERRIDE header, but that doesn't work for me either. On Nov 28, 9

Re: [Rails] Cant install any gems on windows

2009-12-19 Thread Colin Law
2009/12/19 giorgio : > Hi > > I have just setup instant rails on a windows box. > > I have migrated an app from Linux and I need to install some > additional gems and upgrade rails to be the same version as on the > Linux environment. > > I am completely unable to install any gems. > > I get messag

Re: [Rails] big time help(any idea for a proper title..)

2009-12-19 Thread Rick DeNatale
On Sat, Dec 19, 2009 at 6:34 AM, radu puspana wrote: > Hey guys, > > i ran in some trouble while making an important app for school, and > the deadline is so soon, that i took a desperate decision, bother > you.. > I will put up the code here, and if anyone has a solution, it would > mean the worl

[Rails] Re: unknown attribute: commit

2009-12-19 Thread salamander
Rick, You hit the nail right on the head! In my controller, I had the following: @nominator = Nominator.new(params) When I changed it to @nominator = Nominator.new(params['nominator']) that cleared it up! Thanks! -Sal On Dec 18, 7:43 pm, Rick DeNatale wrote: > On Fri, Dec 18, 20

RE: [Rails] Re: single table relation, newbee question

2009-12-19 Thread Joe McGlynn
I just wrote a 3-part article on Rails STI here: http://joemcglynn.wordpress.com -Original Message- From: rubyonrails-talk@googlegroups.com [mailto:rubyonrails-t...@googlegroups.com] On Behalf Of adrianb Sent: Friday, December 18, 2009 8:48 PM To: Ruby on Rails: Talk Subject: [Rails] Re:

[Rails] Re: TinyMCE v. FCKeditor v. others

2009-12-19 Thread Jakub
I am quite happy with TinyMCE and there is a Rails plugin that simplifies the usage. If you use ActiveScaffold, it has a bridge that you can use and have TinyMCE editing in practicly no time. The file upload is AFAIK supported by a plugin fork http://github.com/devon/tiny_mce_plus/ but i have not

Re: [Rails] accessing another controller's data

2009-12-19 Thread maryam kamali
HELLO I AM DEPRES AND CIK On Sat, Dec 19, 2009 at 5:08 PM, oubbou wrote: > Hello everybody, > I'm ruby/ror newbie > > I'm trying to generate a site map of a website. Website is divided to > three parts (each has own controller). In every controller(in init > action) is variable @left_menu, which

[Rails] accessing another controller's data

2009-12-19 Thread oubbou
Hello everybody, I'm ruby/ror newbie I'm trying to generate a site map of a website. Website is divided to three parts (each has own controller). In every controller(in init action) is variable @left_menu, which is a hash containing a sub- navigation of current part of the site. The problem is th

[Rails] Cant install any gems on windows

2009-12-19 Thread giorgio
Hi I have just setup instant rails on a windows box. I have migrated an app from Linux and I need to install some additional gems and upgrade rails to be the same version as on the Linux environment. I am completely unable to install any gems. I get messages like the following examples: E:\gio

[Rails] Re: Newbie problems with scaffolding

2009-12-19 Thread radu puspana
Hi dude, So, to create a model, a controller and layout/views, complety functional, with basic events CRUD(create read update delete) u open a terminal, get inside the folder of your app, and write 1)ruby script/generate scaffold ModelName column1:type column2:type ...columnN:type and hit enter :)

[Rails] CSV - Error- Please help me

2009-12-19 Thread Rails ROR
Hi all, I have a books controller in which i have a list of all books displayed. I want to have a csv download option. The point is that i want csv download according to the pagination. When i click on first page and click csv download i need to get only first 2 records(per page=>2) When i cli

[Rails] big time help(any idea for a proper title..)

2009-12-19 Thread radu puspana
Hey guys, i ran in some trouble while making an important app for school, and the deadline is so soon, that i took a desperate decision, bother you.. I will put up the code here, and if anyone has a solution, it would mean the world to me and my work. My problem is this line of code li.product =

[Rails] Re: Regular expression: How do I allow forward slashes?

2009-12-19 Thread Alan
Use Ruby's other regexp syntax: %r{pattern} To continue your example below: validates_format_of :url, :with => %r{^[-\w_./]+$} AlwaysCharging wrote: > In my app, I allow users to submit urls. They (of course) need the > ability to submit urls with a forward slash, "/", but whats the > regu

Re: [Rails] Re: Regular expression: How do I allow forward slashes?

2009-12-19 Thread Sven Riedel
Sven Riedel wrote: > /^http:\/\/myhostname\.com\/foo$/i > > would become > > %r{http://myhostname\.com/foo}i And of course I forgot the anchors in the second example. So the correct version is: %r{^http://myhostname\.com/foo$}i -- You received this message because you are subscribed to the Go

Re: [Rails] Re: Regular expression: How do I allow forward slashes?

2009-12-19 Thread Sven Riedel
frogstarr78 wrote: > Have you tried escaping them "\/"? Another way would be to use %r, that way you can avoid the leaning toothpick syndrome alltogether; /^http:\/\/myhostname\.com\/foo$/i would become %r{http://myhostname\.com/foo}i But before you start piecing your own regexp together have

[Rails] Re: Regular expression: How do I allow forward slashes?

2009-12-19 Thread frogstarr78
Have you tried escaping them "\/"? On Dec 18, 11:01 pm, AlwaysCharging wrote: > In my app, I allow users to submit urls.  They (of course) need the > ability to submit urls with a forward slash, "/", but whats the > regular expression to allow them to do that? > > I currently use: > > validates_f