ruby-on-rails

What web-service can I use to send MMS from my web app?

I am looking for a web service API that I can use to send MMS messages. Most web services like Twilio and TextMarks only support SMS. I am looking for a similar service that supports MMS. Are there any out there? ...

Array Merge (Union)

I have two array I need to merge, and using the Union (|) operator is PAINFULLY slow.. are there any other ways to accomplish an array merge? Also, the arrays are filled with objects, not strings. An Example of the objects within the array #<Article id: 1, xml_document_id: 1, source: "<article><domain>events.waikato.ac</domain...

how to have linked drop downs in a rails form

How can I have linked drop downs on a rails page. both drop downs will be coming from database. for example If first drop down is category (coming form category table). second drop down, products, also coming from db, will be populated based on selection of first drop down? ...

How do I create a facebook style news feed in ruby on rails?

I am trying to fuse to objects into a single stream. I created a new model and controller called Newsfeed. I have it so that newsfeed has_many :messages and has_many :images and images and messages belong_to :newsfeed. I am setting up the controller right now and I have: def index @messages = Messages.all @images = Images.all ...

Filtering a Table in Rails

I am working with will_paginate to create a sortable and searchable table. I have got everything to work correctly with the exception of the search box (filter). Right now when I select a different query (other than "title") and search for something, it only searches for title querys. Can anyone help point out where I am going wrong? Th...

Rails & Capistrano - Deployment gem issues

I've frozen my gems locally, and commit them in latest git version. I pushed this to my production server, and my capfile automatically pulls this when deploying (via locally stored git). Now the issue I run into is that even though I know the server has the gem installed, when I deploy using "cap deploy:cold", I get the following erro...

Problems while upgrading the rails version.

I'm a newbie to Ruby on Rails. My problem is, I am trying to upgrade the rails version from 1.2.3 to 2.3.4. I changed the .rhtml files to .html.erb according to the rails version 2.3.4. I changed the environment and boot.rb settings according to the rails version, but when I try to run the application, I'am getting missing template err...

How should i convert existing html.erb to Haml

Hi I have the rails project, the views only consist with HTML.ERB files , my client wants to convert ERB to HAML. I have too many views file.. its get huge time to convert file by file . So that any simply way i can able to convert html to haml... i install haml plugin under my project ...

How do I use a custom helper method from a model in Rails?

There is a helper method in my custom helper module EntriesHelper that I need to use from inside a model. I watched the Railscasts episode Helpers Outside Views and learned about ActionController::Base.helpers, but this only gives you access to the built-in helpers. I don't want to simply include EntriesHelper in the model because of nam...

Following Authlogic tutorial but: undefined method `email' for #<UserSession: {:unauthorized_record=>"<protected>"}>

I followed the official Authlogic tutorial but something came up. I successfully created a user, but when I try to show his profile page, I get the following error: undefined method `email' for #<UserSession: {:unauthorized_record=>"<protected>"}> Here's the relevant code: # user.rb class User < ActiveRecord::Base acts_as_authe...

406 Not Acceptable error when using Jquery $.post in Firefox but not in Safari or Chrome

I'm using Jquery (1.3.2) $.post command to trigger an ajax call to a rails server. The code works great on Safari and on Google Chrome (mac), but when I tried it on Firefox (3.5.7), I got a weird '406 Not Acceptable' error. When I look at the headers, it Firefox indicated that it accepted only ' text/javascript' responses. And the ...

validates_presence_of in a module

i have a model. i want import in this model a module. in this module i want insert a validates_presence_of for the models that import it I want know if and how is possible to do something like this: class Ele < ActiveRecord::Base include Mod end module Mod validates_presence_of :field end Thanks ...

Rails: huge data import to three connected tables...

Hi everybody, Im looking for a good way to solve my performance issues in my rails application. I have three tables which have: one to one to many connections in between. If I want to fill in 130 items of the first table with all the data for the underneath tables, It results in about 1000 queries and takes about 10 seconds (SQLite DB)....

use reserved rails word in scaffolding

Hi all, I'm new to rails, but not to programming. I'm trying to create a Case Management app, I'm running the command ruby script/generate scaffold Case casename:string caseid:string This works fine, however because Case is a reserved word I'm getting errors when trying to view localhost:3000/Cases Is there anyway around this or do ...

Need help to upgrade my rails version

Hello experts. I am new to Ruby on Rails. I need to upgrade my rails version from 1.2.3 to 2.3.5.I am working in the windows environment with mysql database.Could you please help me with the steps involved to upgrade the rails version clearly. Thank you ...

Capistrano to deploy rails application - how to handle long migrations?

So I am using Capistrano to deploy a rails application to my production server (apache+passenger) and at the moment deployment usually goes along the lines: $cap deploy $cap deploy:migrations It got me wondering, let's say my db:migrations took a long time to execute on the production server (a big refactor of the db schema) - in this...

I want to use a controller with an expected nil; how do I handle this?

I have created a site which utilizes subdomains and searches whether or not the user is at: subdomain.domain.com or domain.com. If the user is in subdomain.domain.com, /views/layouts/application.html.erb appears, if the user is in domain.com /views/layouts/promo_site.html.erb appears. To accomplish this I closely followed Robby on Rails ...

overwrite association results

Hi, i have 3 models users, companies and roles User belongs_to role User has and belong to many companies Role has_one User Thru this association i can do something like: User.companies <-- i get all companies that a user has User.role <-- i get the role that a user belongs_to I was thinking now, when a user has role_id == 0 (admin...

Flickr style resizing with attachment_fu

I want attachment_fu to resize my thumbnails in a similar way to how flickr, facebook and twitter handle this: If I want a 100x100 thumbnail I want the thumbnail to be exactly 100x100 with any excess cropped off so that the aspect ratio is preserved. Any ideas? ...

nil object error

Here's the output: Parameters: {"action"=>"confirm", "id"=>"1", "controller"=>"sites"} User Columns (2.2ms) SHOW FIELDS FROM `users` User Load (0.3ms) SELECT * FROM `users` WHERE (`users`.`id` = 2) LIMIT 1 School Load (0.3ms) SELECT * FROM `schools` LIMIT 1 Rendering template within layouts/application Rendering sites/confir...