similar to: making an integer from a float

Displaying 20 results from an estimated 5000 matches similar to: "making an integer from a float"

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 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 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 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 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 Jul 05
2
splitting a paragraph into words and spaces
I''m using this: <% words = article.content.split(/ /) %> <%= words[0..20] %> to (ostensibly) split a paragraph into component words, with spaces in between, then print to html only the first 20 items, words and spaces. I got this (split(/ /)) from the online pickaxe book at http://rubycentral.com/book/ref_c_string.html#String.split . The problem is, the resulting array
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 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 Mar 27
3
Enumerable?
Hi, Can anyone please point me to some docs on Enumerable. I can''t seem to find anything on how to use it. Thanx -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060327/0825d5e8/attachment-0001.html
2006 Jun 07
1
Setter that converts a float attribute to integer
Hi, I have some problems with an application where I''m using custom accessors to do currency conversions. In my model, I have a price attribute in the database that stores the value in cents, to avoid future problems with float arithmetic and round. But at the views, I would like to show the price in euros, with decimal for the cents. So I defined a new attribute called price_in_euros,
2006 Jun 18
6
integer array columns
Postgres database. I have a categories table, with two columns id, and name. I have a recipes table, with a category_ids column. I want each recipe to belong to one or more category. in recipe_controller.rb I have this: def create @recipe = Recipe.new( @params[''recipe''] ) @recipe.category_ids = @params[''recipe''][''category_ids''].map{
2006 Jun 23
6
float calculation error
Hi I have the following values pActualCost = 33.00 pPaymentCost = 29.99 So this calculation should leave me with 0.01 pPaymentDifference = pActualCost - pPaymentCost however when doing this in rails, it returns 0.00999999999999801 has anyone got any suggestions to whats going wrong and how I can correct this Thanks Scott -- Posted via http://www.ruby-forum.com/.
2006 Jul 06
3
Calling Method
Is there a way to call a method if I only have a string that contains the method name. For example: @methods = [''method1'', ''method2'', ''method3''] @step = 1 # I want to call method2 which has a definition in this class -- Posted via http://www.ruby-forum.com/.
2005 Apr 17
2
array indexing and which
Hi R friends! I am stuck with a stupid question: I can circumvent it but I would like to understand why it is wrong. It would be nice if you could give me a hint... I have an 2D array d and do the following: ids <- which(d[,1]>0) then I have a vector gk with same column size as d and do: ids2 <- which(gk[ids]==1) but I can't interprete the result I get in ids2. I get the
2007 Jul 24
1
My id's are all float?
I''m using Oracle to back my Rails app, and I noticed somewhere along the line that if my ID is declared as NUMBER then it wants to show up as "123.0" whenever I ask for it (i.e. link_to and other things). This didn''t seem to be a problem, so I was ignoring it. Recently upgraded to Rails 1.2, however, and now that doesn''t route anymore. Is there some place
2012 Jul 18
5
string array to integer array
array=["1","3","4"] How do i convert this array to sessionarraydb_array=[1,3,4,] -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from
2006 Feb 01
4
Where is the send() function?
Hi, in the tutorial "4 Days on Rails" the following code fragment is used: ,---- | <% for column in Category.content_columns %> | <td><%=h category.send(column.name) %></td> | <% end %> `---- Apparently, the send() function returns the column value by name, but where does this function comes from? Unfortunately, neither the tutorial nor the API
2006 May 31
3
Database can''t connect -
I''m sorry guys. I''m really still such a newbie at this. i''ve been having trouble getting my Rails apps to run on Dreamhost, and I think it might be a problem with the database connection. Anyway, I read on Code Snippets that I should do this: [rhod]$ ruby -Iconfig -renvironment -e "p ActiveRecord::Base.connection" to find out if my database.yml file is