Is there a way to have rails print out a number with commas in it?
For example, if I have a number 54000000.34, I can run <%= number.function %>, which would print out "54,000,000.34"
thanks!
...
I have a fairly vanilla rails app with low traffic at present, and everything seems to work OK.
However, I don't know much about the rails internals and I'm wondering what happens in a busy site if two requests come in at the same time and try to update the same model, from (I assume) two separate mongrel processes. Could this result i...
I'm trying to add disqus comments per-marker on a google map. To make it per-marker, I've added an iframe to the infowindow, with a different URL for each marker. It works, and I can post comments, but the infowindow isn't updated after a successful post; the spinner remains. Firebug says:
Access to 'file:///foo/gmap/comments.html?dsq=1...
Suppose I use a custom :format to implement a gadget-oriented version of my site. The general idea is that I can reuse controllers with custom, gadget-oriented views.
Is there any way to make all URL helpers called from that particular format keep the same format, without hardcoding it into all helpers?
I'd like to keep controllers un...
I am trying to do some Cucumber testing like the following:
Given I am logged in as admin
When I go to the article page
Then I should see "Edit Article"
And I should see "Article Title"
where the path to the article page is "articles/1" or some known id.The problem is that when I insert my data using my step definition
Article.create...
I have seen two different approaches in saving user preferences.
APPROACH 1:
Serializing them and saving in one of the column of USERS table
APPROACH 2:
Creating a separate table PREFERENCES and make a has_many association from USERS to PREFERENCES.
Which one of the above two approaches would you prefer and what are the pros and cons...
What would you suggest as the best server stack for a dedicated server which needs to host Rails SaaS application (not a lot of traffic but need to keep options open for future).
...
I am getting a bug when I use a text_area in my rails app. The box takes line breaks, and makes them indentation. Here is a screen shot, any idea where these indentations are coming from?
https://files.getdropbox.com/u/312568/Picture%2031.png
...
Hello,
I would like to add authentication to my Rails app. I came across few plugins that do this: acts_as_authenticated, restful_authentication, Authlogic...etc
I haven't seen an article that describes differences, advantages and disadvantages of using each.
Can you help with that? which one do you use and why?
Thanks,
Tam
...
Consider a typical social networking website, which has more or less the following models:
User
Blog, Posts
Forums, Topics, Responses
Wiki, Pages
....
....
I want to introduce a model called Site/Space where each User can have one or many sites/spaces. And I want to provide a way for the Site owner to select many features (or call i...
Hy guys. I've created a simple blog app with the usual CRUD actions. I've also added a new action in the PostController called "archive" and an associated view. In this view I want to bring back all blog posts and group them by month, displaying them in this kind of format:
March
<ul>
<li>Hello World</li>
<li>Blah blah</li>
...
Hey guys,
for a rails project I need to provide the user with a downloadable HTML version of a statistics page. I got so far as creating a controller action that will set the header as follows and then render and return my vanilla html page:
headers["Content-Type"] ||= 'application/x-unknown'
headers["Content-Disposition"] = "attachmen...
My index.html page for my project needs some Ruby code so I need to change it to a .erb extension. How do I configure Rails to identify the index.html.erb file as the starting page of the project instead of the index.html file?
...
I have to add Wufoo-like WYSIWYG form-builder functionality to a Rails webapp.
Does anyone know of good resources (gems/engines/plugins/example code) that would help?
...
Hey,
How do I write a route that maps a path like this?
/powerusers/bob/article-title
This is what I got so far:
map.resources :users, :as => "powerusers" do |users|
users.resources :articles, :as => ''
end
This gives me the following route:
/powerusers/:user_id//:id
How do I get rid of the double backslah? /powerusers/admin//f...
I'm hoping this will be an easy one :) I've been stuffing around for hours playing with the has_many options trying to emulate this:
has_many :pages, :finder_sql => %q(SELECT * FROM `pages` LEFT OUTER JOIN `component_instances` ON `component_instances`.instance_id = `pages`.id AND `component_instances`.instance_type = 'Page' WHERE `comp...
I'm implementing a Rails application in which users will be able to store snippets of code for later reference. I'm planning to use Markdown for text entry and will probably use the wmd markdown editor. (The very one Stackoverflow uses.)
I'm a little concerned about the idea of people entering code into the edit box. From what I underst...
I apologize for this silly question but is ISBN-10: 0596527314 Rails Cookbook 2009 or 2007? Amazon has it listed as 2009 but I can't confirm as everywhere else it seems to be 2007:
http://www.amazon.com/Rails-Cookbook-Cookbooks-OReilly-Orsini/dp/0596527314
Is there a new version available on pdf or something?
...
This is more a general question but my particular case involves a ruby/rails app using the Google map APIs (v2).
I'd like to take a lat/long point and get an address (standard rev geocode) and then take that address one step further to see if there is a specific business name associated with it.
So, as an example say (numbers pulled ou...
Let's say I have a model class called Project, but instead of this:
class Project < ActiveRecord::Base
I wanted to write this:
class Project < ORM
so that the specific ORM implementation is not present in my model class.
How would I need to write my ORM class so that the Project class above is able to act as a subclass of ActiveRe...