Displaying 20 results from an estimated 700 matches similar to: "splitting a paragraph into words and spaces"
2006 Jul 05
3
splitting a story with double-spaced para''s
Quick question - if i want to separate a long string of text, separated
by single carriage returns, into an array of paragraphs, I can use the
following code:
paragraphs = article.content.split("\n")
The "\n" means a carriage return, as far as I can tell.
If I wanted to take text, that had been written using the more common
double carriage returns, into an array of
2006 Jun 01
4
How do I get today''s date?
I know this is a simple question, but i just want to put the current
day, month, date and year on my website. I still can''t figure out how to
read the Rails API. Can anybody help me out? TIA
--
Posted via http://www.ruby-forum.com/.
2006 Apr 06
2
making an integer from a float
Does anybody know how to turn a floating-point number (i.e. 60.345) into
an integer by cutting off or rounding the decimal portion? Either
method, or both, would be quite welcome. Thanks! This forum rocks!
--
Posted via http://www.ruby-forum.com/.
2006 May 12
8
switching from development to production?
I think I''m missing a step here, but they don''t seem to cover this in
the AWDWR book... does anybody know the various steps required to switch
from development to production mode in Rails? I''ve scoured the
application and changed everything that stands out, but the damn thing
is still running off the development database and won''t connect to the
production
2006 Apr 03
15
How should I pick a random entry from the database?
Hi guys. Total newbie here. I''ve been doing web stuff since 1996 but
only began the foray into scripting last year. I haven''t got my skull
completely 360 degrees around OOP yet. It''s just me here (in Japan) and
there are no Ruby groups in my area (never mind any in English).
I''ve got a database table - real simple: question, answer, and id fields
- and I
2006 Aug 15
0
scan syntax question
I was going through the syntax on this site:
http://www.rubycentral.com/ref/ref_c_string.html
trying to figure out how to parse my tags. Basically I have a tags
field that returns a value a = ''new york'' table
I want to parse it so that I grab the new york and the table but the
only way I know to do it is with scan such as: <%a=st.scan(/\w+/)%>
which returns three
2006 Mar 30
7
text_area
How to make that the typed code on ruby in text_area it was carried out
in @params ["name"]??
--
Posted via http://www.ruby-forum.com/.
2006 Jun 06
8
How do I wrap a <%= link to %> around an image?
I''ve got a bunch of dynamically generated link paths that I want to use
to link some dynamically-generated image paths. Specifically, I want to
link thumbnails in a gallery to the larger images.
But I''m stymied by Rails'' syntax. I can''t figure out how to do this.
I tried this:
<%= link_to(image_tag("../../images/photos/photo.photogroup/TN_
2006 May 17
5
Today is "Rails Hates Me Day"
Has anybody had Rails just refuse to cooperate with anything?
I had an application working great in development mode, then switched it
over to production, tried to host it, but couldn''t. Some error that I
can''t figure out. So I decided to create a simpler application, host
THAT in little baby steps until something went wrong so I could tell
maybe where I was losing it.
2006 Jun 08
1
built-in dropdown jumps?
Hey everybody! I was just wondering if Rails'' javascript library
includes something as simple as making a dropdown that jumps to the link
when selected without needing a "submit" button. I see a bunch of AJAX
effects and draggable-element stuff, but all i need is a simple
dropdown... should I code it myself?
--
Posted via http://www.ruby-forum.com/.
2006 Jun 16
3
ActiveRecord, using sql functions for some attributes
Hi.
I need to use functions INET_ATON, INET_NTOA for IP address retrieving.
Is it possible to make this transparently (without custom SQL for
saving, updating and retrieving)?
2006 Apr 06
6
select method
The documentation states as an example:
select("post", "person_id", Person.find_all.collect {|p| [ p.name, p.id ] },
{ :include_blank => true }) could become:
<select name="post[person_id]">
<option></option>
<option value="1" selected="selected">David</option>
<option
2006 Apr 05
25
How to avoid bunch of <% %> ??
Hello, I would like to know is there is a way to avoid poluting the
views with tons of <% %> ?
Like this
<%= start_form_tag() %>
<%= text_field_tag(''category[title]'', category.title, {:size => 20,
:maxlength => 128}) %>
<% if not category.parent_id.nil? %>
<%= select("category", "parent_id",
Category.find(:all,
2006 Apr 07
22
Find WHERE in Rails
I''d like to find all records that have a certain integer as their
"level" field in the database. I know how to find all the records:
allquestions = Question.find(:all)
...and I know how to find the one record that has a certain id:
allquestions = Question.find(params[:id])
...but how do you find all the records that share a certain value in one
of their fields? I tried
2006 Apr 06
2
using select() to relate tables
I''m sorry to be asking trivial questions, but I''m new to RoR and am
hooked :), so I''m very impatient to get things up and running.
given two related tables, "pcs" and "venues" (venues have many PC''s and
each PC belongs to one venue only) I can use a select() to present venue
names in the "new PC" form along with other PC details to
2006 Apr 11
26
Firefox won''t let me send ''&'' with AJAX!
Hi everyone,
I''ve encountered a HUGE problem, which may not be RoR-oriented, but
there might be a workaround somehow.
See, at this moment, I''m unable to send AJAX requests back and forth
when the information contains an ampersand (''&''). In essence, request is
never completed. The odd thing is that it only happens with Firefox (IE
and Opera works fine).
2006 Jul 05
1
time.next_week bug?
i ran into an error today when dealing with the method next_week and
daylight savings time...
>> Time.local( 2006,10,23 ).next_week
=> Tue Oct 24 00:00:00 EDT 2006
Any one know if this is a know issue or should a ticket be created for this
issue?
thanks for the help
mark
--
Mark Van Holstyn
mvette13@gmail.com
http://lotswholetime.com
-------------- next part --------------
An HTML
2006 Jul 03
2
Still struggling with data flow ...
Hello,
The following view:
<%= start_form_tag %>
Enter term to find
<p>
<%= text_field_tag :name, params[:name] %>
</p>
<%= link_to "Find", { :action => ''find_term''} %>
<%= end_form_tag %>
does not appear to pass back the value of :name to the action:
def find_term
term =
2006 Apr 07
2
ActiveRecord find all based on array -- need ids from array
Does anyone know if it is possible to perform an ActiveRecord find by
passing in an array? I would like to be able to do the following:
MyModel.find(:all, :conditions => ["user_id in (?)", users])
The problem I run into is that the returned SQL contains the to_s()
output of the User object, not the ids of those users. Is it possible
to change this behavior? I attempted to
2006 Aug 18
4
Button on view
Hi,
I have a page containing 3 views (2 are partials). One of the partials
needs to have a button that will clear a table called "messages" in the
database.
I can put a button like this "<%= button_to "Clear Messages", :action =>
''clear_messages'' %>" and have the controller do "Message.delete_all".
But the problem is that the