ruby-on-rails

What technology (asp, php, joomla, rails, grails...) for a website from scratch ?

Hello, I am starting up a new website that will need to meet the following requirements : Performance and Scalability : I am aiming to have some high traffic with high number of concurrent connections during few minutes. No heavy contents (like Flash or Videos) will be present in the first version Mobile Site : The first version will ...

Mobile version of views for Ruby on Rails

Hello, I'm after some validation that I'm doing the right thing. I have my Ruby on Rails application in the following structure: /home    about.rhtml    index.rhtml /display    index.rhtml /data <--This is called by jQuery from the display\index page to provide the data to render    push.js.erb    pull.js.erb /layout    home.rhtml    ...

E-mail Templates in Ruby on Rails

I need help with e-mail templates. I have an html template with three embedded images in it. I am using the restful authentication plugin and have tried to customize the default mailer. The template works great as a standalone webpage but for some reason is not rendering properly with the images. I can either get the images to attach...

How to test association extension logic in rails with minimal DB overhead.

I am a fan of using mocks and stubs everywhere I can to keep my specs running quickly. I'm kind of stumped as to how I might do this to test the find_special method in the following: has_many :foos do def find_special if proxy_owner.baz ... find stuff else ... find other stuff end end end ...

Template declaration to dynamically find views in RoR

Hello, I'm trying to separate the views for the different platforms into different subfolders. I have done this for the layout, at the moment I have the following: class MoviesController < ApplicationController    layout :site_layout    def site_layout       if(iphone_request?)          "iPhone/movies"       else          "movies"   ...

Rails: installing & running Textile Editor Helper

I'm trying to get a Textile Editor Helper on my Rails site. I installed the latest version from git, installed it and now trying to get things running. I put the code: <p> <%= f.label :message %><br /> <%= f.textile_editor :message -%> </p> but Rails return an error, pointing I don't have a proper method: undefined method `tex...

Rails Currency Formatting

I'm working on a Rails app and I'm trying to figure out the best way of allowing users to change the currency format of a report. It's not something that would be tied to their country or location since they may have to send the report to people from other countries. I initially only want support for these 3: USD, GBP, and EUR Also, t...

Custom SQL query without Corresponding Table

I have a SQL query that isn't table-specific and I don't know how to handle it with Ruby On Rails. Here my SQL query (you don't need to understand it): SELECT type, actor_id, events.created_at, photo_id, photos.user_id FROM (SELECT 'comment' AS type, user_id AS actor_id, created_at, photo_id FROM comments UNION SELECT 'classification'...

Retrieve from multiple relations, ruby on rails

Hello, user (has_many :user, has_many :comments) post (belongs_to :user, has_many :comments) comment (belongs_to :user, belongs_to :post) Now I am trying to retrieve all posts (having atleast one comment of the user) updated with comments from last comment of user in that post (i will be using user's updated_at attribute for this) Exa...

What scaffold generator was used in the Live Validations demo screencast?

In http://vimeo.com/3385181 Live Validations are demoed with what appears to be a standard scaffold-generated rails app. However, the styling is different (nicer) than that created by the standard rails scaffold generators. What generator was used to make the video? ...

Rails app crashes and burns when sending a GET request with Content-Type header set

I have created a rails application that has a simple RESTful json API. This has worked for a while, but now we have run into a problem. The javascript framework that makes requests adds a "Content-Type" header to all requests . . . including GET requests. It sets the header to "application/json" and causes the rails app to crash and burn...

How do I tell ActiveRecord not to log any control chars

Is there any way to tell active record not to log the ansi color codes when its logging stuff? Eg. I do not want this in my logs. [4;36;1mSQL (0.1ms)[0m [0;1mSELECT count(*) AS count_all FROM `users` WHERE (`user`.id = 133) [0m Instead I want this: SQL (0.1ms) SELECT count(*) AS count_all FROM `users` WHERE (`user`.id = 133) I...

How can I pass objects from one controller to another in rails?

I have been trying to get my head around render_to but I haven't had much success. Essentially I have controller methods: def first #I want to get the value of VAR1 here end def second VAR1 = ["Hello", "Goodbye"] render_to ?? end What I can't figure out is how to accomplish that. Originally I just wanted to render the first.ht...

How to change Redmine to support versioned files in every issue

Its redmine, a Ruby on Rails application. Currently, every issue can have one or more files. But if a user decide to update/change them, the old files are replaced. My task is to develop something to allow versioned files for every issue: so, if a user update the content of an existing issue, the previous state of the issue is preserved ...

Is it safe to use Capistrano?

I have a Gallery-style app that has been already deployed. My local version has many photos that I use only for local testing, and I absolutely do NOT want them to overwrite my real photos which are online. I also have a git repository which only tracks my code and ignore photos. When I type cap deploy:migrations does it use my git re...

Ruby, gsub and regex

Quick background: I have a string which contains references to other pages. The pages are linked to using the format: "#12". A hash followed by the ID of the page. Say I have the following string: str = 'This string links to the pages #12 and #125' I already know the IDs of the pages that need linking: page_ids = str.scan(/#(\d*)/)....

rails validating multiple child models in a complex form

Hi, I am using multiple child models in a complex form (a la http://railsforum.com/viewtopic.php?id=28447). The form works great, but I need to validate a property of the set of child models before accepting the form data into the database. I've come up with one mostly-working, very-kludgy way of doing this. Seems like there has to be a...

using join model attributes in rails has_many :through

as an example, i have a model Group and model User they are connected with :has_many, :through => groups_users groups_users table has an attribute, called moderator, specifying whether a user is a moderator of the group question: how do i access all moderators of a given group? after reading about :with_scope, what comes to mind is ...

RoR resources: No action responded to 1

Hi everyone I'm using the following code to map my resources for my products controller: map.namespace :admin do |admin| admin.resources :products end In my view I'm using link_to 'Edit', edit_admin_product_path(product) which results in the URL /admin/products/1/edit when I'm clicking on the link I'm getting ...

routing error when requesting http://localhost:3000/file2.html [POST]

create a blank Rails application and put two files under public foler: file1.html and file2.html. The contents of file is this <h1>Post</h1> <form action='/file2.html' class='openid' method='POST'> <input name='openid_username' type='text' /> <input type='submit' value='Login' /> </form> <h1>GET</h1> <form action='...