Paperclip - images duplication
Hi, I would like to not duplicate the image if it's the same that is posted, Like: user1 post an image user2 post the same image 2 # images in the db Is there a way to handle that ?? Thanks, ...
Hi, I would like to not duplicate the image if it's the same that is posted, Like: user1 post an image user2 post the same image 2 # images in the db Is there a way to handle that ?? Thanks, ...
I am trying to have a plugin I am developing auto-reload every time I change my code, emulating the same auto-reloading that happens normally in Rail's development mode. My plugin is primarily an ActiveRecord mixin module. I have tried all suggestions I have been able to find in related Google searches. Nothing has worked yet. In my ...
With the launch of Amazon's Relational Database Service today and their 'enforced' maintenance windows I wondered if anyone has any solutions for handling a missing database connection in Rails. Ideally I'd like to be able to automatically present a maintenance page to visitors if the database connection disappears (i.e. Amazon are do...
Hello all, I am having the following problem: I have an ActiveRecord model called Widget that has some fields, we'll call them field_a and field_b, in addition to the standard Rails fields. I also have a model called Person that has many widgets through a has_many association (Person.widgets). In the create action of my controller fo...
Hey peeps. I am a beginner-verging-on-intermediate rails developer that is working hard to improve my skills. I am a little confused about the state of JRuby, and whether it is a viable alternative to switch to from the MRI. Currently I run a Mac at home and edit using textedit (MRI for ruby, terminal for rails commands, etc). At w...
I have been struggling for the past few hours thinking about which route I should go. I have a Notification model. Up until now I have used a notification_type column to manage the types but I think it will be better to create separate classes for the types of notifications as they behave differently. Right now, there are 3 ways notifi...
I am trying to allow users with role "corporate" to access their own company. Currently a user with that role gets blocked. If i login as admin or change the access control to allow all, it works fine. The issue is pertaining to Corporate user role having a company. here is all the code http://pastie.org/672733 User controller class...
I am a complete newbie to the world of Ruby & Rails moving from the land of PHP & Symfony. I'm currently attempting to setup the Facebook Connect plugin & Twitter oAuth for authlogic. Authlogic works no problem but both of the others fail when I attempt to call their buttons- can someone tell me where I'm going wrong? I've put the stack ...
I'm using the Google charts API to generate a pie chart in my Rails application. However, I'm having a problem passing local variables to the def in the helper. The def takes a 2D array of [label, value] pairs. It doesn't like it when I try to pass a local variable in as the value. These are calculated ahead of time and are in currenc...
I am creating a rails application that needs to store a large amount of sensitive data. To assure my customers that the data is being protected, I want to encrypt it on a per-user basis. I have done research looking for gems that can accomplish this. So far I've found strongbox and safe. Together, this would seem to provide a solutio...
I imagine this has a rather simple answer <% for user in @users %> <li> <%= link_to user.username, user %> </li> <% end %> Taking my simple example above, how would I apply a class to my <li> to the first three instances returned? Secondly, how could I just have the the second two items have a different class from the first o...
I'm investigating a feature to allow users to point their own domain names at our service to provide a more complete white-lable offering. So, I end up with multiple domains hitting the same IP. How do I provide SSL security for this? Do I need a cert per domain? UC certs? How would you deploy and manage this in a rails app? ...
Is there a way to disable SQL logs in Rails, other than changing the log level? I've got some logger.debug statements that I'd like to print out in my ActiveRecord models, but I want to hide the SQL statements. ...
Hi all, I have a form that has a group of 3 text_fields. I need two of them filled to make calculations. quantity must always be filled. If price is blank, then cost must be filled, or vice versa. I tried this, but price is never nil, even though I leave it blank. I also tried :price == nil and :price.blank?, but they do the same thing...
this is what I have in my view: <% form_remote_tag :url => { :controller => 'comments', :action => "create", :post_id => "#{@post.id}"}, :html => {:id => 'comment_form' }, :before => "tinyMCE.triggerSave(true,true);" do %> <%= label_tag 'Comment' %><br/> <%= text_area_tag :comment_body, nil,:rows => 10, :cols => 100 %><...
In Ruby on Rails, is it possible to change a default action for a RESTful resource, so than when someone, for example, goes to /books it gets :new instead of the listing (I don't care if that means not being able to show the listing anymore)? ...
Hi, I'm using PaperClip plugin in my Rails application as follows: has_attached_file :photo, :styles => {:small => '64X64>', :medium => '250X250>'}, :url => "/assets/user_photos/:id/:style/:basename.:extension", :path => ":rails_root/public/assets/user_photo...
Why you may ask? Because i have built the app on mysql and need to start using postgres for GIS component of my app only. Eventually i will migrate to postgres completely but in the mean time would like to know if this is possible ...
Hello, I'm using Delayed Job to manage background work. However I have some tasks that need to be executed at regular interval. Every hour, every day or every week for example. For now, when I execute the task, I create a new one to be executed in one day/week/month. However I don't really like it. If for any reason, the task isn't co...
I'm not able to access urls in my integration test that require an admin user despite creating an admin user session. My test fails on a 302 error. class NewsItemsController < ApplicationController before_filter :require_admin_user, :except => [:show, :index, :feed] etc... end --test/inetgration/admin_stories.rb -- require '...