ruby-on-rails

Mananging upload of images to create custom pdfs on heroku - right tools

Hi Im desiging an app which allows users to upload images (max 500k per image, roughly 20 images) from their hard drive to the site so as to be able to make some custom boardgames (e.g. snakes and ladders) in pdf formate. These will be created with prawn instantly and then made available for instant download. Neither the images uploa...

Access URL on another website from a model in rails

I want to access a URL of another website from one of my models, parse some information and send it back to my user. Is this possible? For example, the user sends me an address through a POST, and I want to validate the information through a third party website (USPS or GMaps) What methods would I use to create the request and parse the...

Updating an attribute in an after create callback results in the entire record being updated

In my Rails application I'm trying to update a model's attribute using update_attribute in an after_create callback. I can successfully update the attribute, but for some reason all the model's other attributes are also updated when I do so. So, even though the model's name attribute (for example) has not changed it is set (to it's curre...

What is the best way to structure a multi-page form to create and edit models in a database?

I'm fairly new to Rails. What is the best way to design/structure a multi-page form in Rails? I would like the form to create a new record in the database immediately when the first page of the form is submitted, and for each subsequent page of the form to update that record in the database. The reason I want the record created immedi...

User membership pattern rails

In the .Net world we have the Membership provider, with this we can fully automate user registration and management. Does such a gem exist for the Ruby on Rails community. I am looking for something that would allow a user to register, retrieve lost password, modify password and login. ...

Need to turn Rails 3 functionality into Rails 2.3.8 functionality.

I have this Rails 3 functionality: http://pastie.org/1131667 and I need to get that turned into Rails 2.3.8.... Can anyone help? Basically I need a custom validation function wherein I can access data members' values at runtime. Many thanks! ...

Why do my Rails 2 routes have query strings?

I sometimes need to pass additional parameters to a page via the URL. I did this in the past with a couple of generic placeholders in the routes file, which I call "genus" and "species". This used to work, but now it has started producing URLs with query strings. The Rails version is 2.3.8. The routes file is: ActionController::Routin...

[Rails and MVC logic] How and where should I implement this?

I have a Service model with title:string description:string date:datetime. I would like to implement a system to create multiple services based on date patterns, e.g. when the user create a new service for Oct 20 he can choose to "repeat" it once a month for 5 months. The final result should be that 6 services are created, due to Oct 20,...

How to order by an attribute of a parent for a polymorphic model in ActiveRecord?

I think I worded that correctly... I have a model called asset which is polymorphic: class Asset < ActiveRecord::Base belongs_to :assetable, :polymorphic => true ... end I have a class level method that acts as a scope: def self.some_scope assets = Asset.joins(:assetable).where('assetable.approved_at IS NOT NULL').order('asse...

One rails application for multiple domain names

I have one rails application needed to be deployed by passenger module nginx. This application needs to be served for hundred domain names. I don't have enough memory to launch hundred rails instances. I'm not sure the proper way to launch rails in few instances. It's the same application under different domain names. server { list...

Make nginx with ruby on rails have case insensitive URLs

We are using nginx + passenger and Ruby on Rails. We would like all URLs, not just controllers and actions to be cases insensitive. This works fine by default on the Mac I'm developing on but when we moved to linux with its case sensitive file system, we have a bunch of broken images. I'd also just like URLs in general to be case inse...

efficient way to store sitewide user activity

Hi, I tried searching through on stackoverflow as well as googling around a lot, but am not able to find answers to my problem (I guess I'm searching for the wrong keywords / terms). We are in the process of building a recommendation engine, and while we are initially logging all user activity in custom logs (we use ruby / rails), we ne...

PHP to Rails 3 routing

Hi, We have a "legacy" flash application relying on PHP to deliver it's data, but the server side is now being upgraded to Rails 3. For various reasons we don't want to change the flash, so we need to be able to route http requests like this: http://www.example.com/somefile.php?param=123&amp;otherone=123457 to RESTful rails routes. I...

Page visits statistics

I need to implement product pages visits statistics (by days). How better to do this in Rails? ...

Using the title of a posting as a unique identifier [Ruby/Rails]

Hi gang! I need to store a range of unique strings. For each unique string, i need to store this in the DB: ["Unique title/unique description"] -> [3][pointer_to_posting 1, pointer_to_posting 2, to_posting 3] I have a model for the posting, but i do not have a model for [unique title]. All I want to do is to store a list of questions...

How to contribute to Rails?

I ran into a problem with ActiveRecord serialization. Apparently, it has trouble serializing hashes where ranges are keys. I found the Rails Lighthouse ticket (https://rails.lighthouseapp.com/projects/8994/tickets/3067-activerecord-cant-deserialize-hashes-with-range-keys). I've never contributed to an open-source project before, and this...

Cucumber and Images

I got a problem with Cucumber. I don't know kow to say to Cucumber that "he" has to click on a picture and then see some text...like I do with buttons or links. When I click on a picture, I have to see the text "USER OK" in the screen. How can I do that? ...

Cucumber,Capybara and ElementNotFound

In my rails application, I have a page with a link that execute a javascript function : <%= link_to_function("Add an address", "add_fields(this)".html_safe) %> In my cucumber feature I have : And I press "Add an address" And the message I get is : Capybara::ElementNotFound: no button with value or id or text 'Add an address' fou...

What sort of encoding/image/formatting issues are there when building a web mail client that pulls emai via pop3

What sort of encoding/image/formatting issues are there when building a web mail client that pulls emai via pop3? Some things i can think of that I know I will have to handle: attachments inline images html emails What other possible headaches are there? ...

Reading Iframe content to controller on ruby on rails

Hi there, I'm trying to do something like that:(ruby in rails) I got an Iframe with content of two text lines example: **"bla bla Http://tt.tt"** How I read this content of the Iframe and set them as two keys in session. example: *session['firstline'] = "bla bla" Session['secondline'] = "Http://tt.tt"* I try'd to get the content...