ruby-on-rails

no such file to load -- yet file is config.gem in environtment.rb file in rails

I keep getting this error for different gems, the most recent is acts_as_reportable: no such file to load -- acts_as_reportable However, I have the following line in my environment.rb: config.gem 'acts_as_reportable' And I also ran the following: >gem install acts_as_reportable It it output: >gem install acts_as_reportable S...

What is causing Apache2 to display PHP as plain text in this config file?

I am trying to run PHP and Rails in the same virtual host, however, PHP is being displayed as plain/text. When I create a test host without all the rewrites and proxy-ing, Apache2 will process the PHP as desired. Where in my config file have I gone wrong? <VirtualHost *:80> #ServerName staging.domain.com #ServerAlias www.domain.com ...

Is there any problem installing Ruby 1.9.1 when i already have installed ruby 1.8.7 running with rails?

I have ruby on rails installed on my Desktop running ruby 1.8.7 and rails 2.3.8 i want to know is installing Ruby 1.9.1 version will mess up with my Rails apps? Thx. ...

duplicate rows in join table with has_many => through and accepts_nested_attributes_for

An event has many artists, and an artist has many events. The join model for an artist and an event is a performance. I want to add artists to an event. This works except that I'm getting duplicate entries into my join table when creating a new event. This causes problems elsewhere. event.rb validates_presence_of :name, :location ha...

What caused the rails application crash?

I'm sure someone can explain this. we have an application that has been in production for an year. recently we saw an increase in number of support requests for people having difficulty signing into the system. after scratching our head because we couldn't recreate the problem in development, we decided we'll switch on debug logger in ...

session[:key] = value doesn't work

I am trying to make use of session data in my application and for some reason I don't have something setup right. The code: session[:key] = some_value Generates the following error: The error occurred while evaluating nil.[] Other controllers don't have an issue with the session, so I am guessing I missed some basic configuration...

Problem using form builder & DOM manipulation in Rails with multiple levels of nested partials

I'm having a problem using nested partials with dynamic form builder code (from the "complex form example" code on github) in Rails. I have my top level view "new" (where I attempt to generate the template): <% form_for (@transaction_group) do |txngroup_form| %> <%= txngroup_form.error_messages %> <% content_for :jstemplates do -%> <%= ...

How to use paperclip to upload file to web hosting via ftp

from title, I create Rails application and use Paperclip to manage file upload but I don't want to store file in local machine, I want to store file in other machine via ftp. Paperclip provide to store file in S3 storage, I want to make paperclip can do like S3 but via ftp. Help me please. ...

Date and Time Conversion in Ruby

I am currently looking on converting Thu Jun 10 16:17:55 +0530 2010 to 15/06/2010 or 15-06-2010 using Ruby I am getting the dates from the DB as shown below. @tickets = Ticket.find(:all) for ticket in @tickets print ticket.created_at end I have been looking around for resources as I a n00b in RoR/Ruby. I have looked...

Good Rails tutorial on How to build an RSS Feed aggregator

I have been using Feed Zirra for some time and I like it. Now, I want to build one.. I am new to rails, Are there any good tutorials to buid RSS Feed aggregator? ...

how to avoid polymorphic associations

Given you have to implement a news feed like the one seen in social networks, ex facebook. Currently I'm using a News class which has a polymorphic assocation which can be of any kind like Image, Comment, Friendship, GroupMembership, etc. Whenever an Object is created, as News is created too. It's working fine with AR but I get into tro...

Rails Paperclip Plugin - Style Options for Resizing

So, I want to resize images to a FIXED width, but proportional height. I have been trying a wide range of operators: 380x242# 380x242> 380!x242 380x242< none of them have the desired effect. Any help? I want it to fill or resize to the 380 width, then resize / shrink the height by the same factor it used to shrink or resize the image...

Sanitizing CSS in Rails

Hello! I want to allow the users of a web app that I'm building to write their own CSS in order to customize their profile page. However I am aware of this opening up for many security risks, i e background: url('javascript:alert("Got your cookies! " + document.cookies'). Hence I am looking for a solution to sanitize the CSS while sti...

Plugin update strategies

I'm developing a plugin which is used in several applications. This plugin is a rails engine with own controllers, models and routes. The controllers, views and models are being generated via simple generator in plugin. Also generator creates migrations for models' tables. The problem I'm facing now is that on any updates to plugin mode...

Include a Class in another model / class / lib

I need to use function "image_path" in my lib class. I tried this (and couple of other variations): class CustomHelpers::Base include ActionView::Helpers::AssetTagHelper def self.image_url(source) abs_path = image_path(source) unless abs_path =~ /^http/ abs_path = "#{request.protocol}#{request.host_with_port}#{abs_path...

Why does the OAuth Unauthorized Error (401) happen?

Sometimes an Twitter OAuth is successfully executed, but an unauthorized error is thrown. I get about 50 of these on a daily basis. It is worrying, because I have no idea how that might be reproduced. What are the different cases where this error happens, and how can this be fixed or prevented? ...

best way to receive email for multiple domains with multiple user accouts into rails app

hi all I have a cms that runs on multiple domains and therefore needs to pull emails into the app for multiple email addresses. I have setup rackspace email for a hosted email solution and am trying to find the best way to pull the emails into my app from all the mailboxes. Should i be using pop3 or imap ? should i be pulling into a ...

Rails & MySQL - Saved HTML Being Truncated at HTML Entity

I'm saving whole HTML documents in the database with ActiveRecord. I can see in the logs that correct INSERT statements are being generated and sent to MySQL but when I actually look in the database after the save has completed, the content is truncated. It appears that &nbsp; entities in the document are causing this truncation. I can ...

Block call in Ruby on Rails

Hi, I'm trying to clean up my code and get rid of a lot of ugly hashes. In my views I define several actions like this: @actions = { :interest => {'Show interest', link_to(..), :disabled => true}, :follow => {'Follow this case', link_to(..)} ... } As these hashes grow, the maintainability decreases. I want to convert the abov...

Deploying a Rails app on an Ubuntu server using Git

I'm completely new to Linux, but today I find myself setting up a server (Ubuntu 10.04 LTS lucid) from scratch to host a Rails application. Anyway, I managed to get a Rails app up and running on the server itself, but I had to scrap that because I want to use Git. So I setup a git repository on the server, then pushed all the code from ...