ruby-on-rails

Getting 500 Error when trying to access Rails application through Apache2

Hey, I'm using Apache2 as proxy and mongrel_cluster as server for my Rails applications. When I try to access it by typing in the url I get a 500 "Internal Server Error" but when try to locally access the website with "lynx http://localhost:8200" it works. This is my config: <Proxy balancer://sportfreundewitold_cluster> BalancerMember...

How to expire a caches_action with a cache_path?

I'm caching an index action with the following: caches_action :index, :cache_path => Proc.new { |c| c.params } expire_action :action => :index The expire_action seems to only expire the index action without any parameters. How can I expire all the caches_action related to index ? (it is a Rails 2.3.5 application) ...

Can I add text to page-source dynamically in Ruby on Rails.

Hi, I would like to add text dynamically to the page source in a particular view. I checked the IO streams, but couldn't find anything. Could you please provide some pointers. Edit: Thanks for the reply. I was trying to know how much time each part/component in a particular view takes to render and log it as part of the page-source. P...

Generating link path with parameters

Hi. I've got model with many associations. User :has_many => :posts, :videos, :images etc I've got helper method, which receives one of this association draw_chart user.videos def draw_chart(assoc) assoc.each do |a| link_to "update", [a.user, a], :method => :put, :remote => true, :confirm => 'orrly?' end end Problem here is...

Ruby, RoR, gmail and NET::SMTP

Is there any way to use gmail as a smtp server on rails 2.3.5/ruby 1.9.1? My smtp settings for actionmailer are options = { :address => "smtp.gmail.com", :port => 587, :domain => 'REMOVED', :user_name => 'REMOVED', :password => 'REMOVED', :authentication ...

Ruby find method with select

I can't seem to get this one right at the moment. I want distinct records but I need other attributes to come along with the results of the find method. Current nonworking code is: Visit.find(:all, :select => "user_id, DISTINCT cookie") ...

Rails Globalize2

How can i implement multiple language translation fields in one form with globalize2? ...

Debugging Actionmailer

I have actionmailer set up. Emails are not being sent, and no errors. Where can I start my search to debug this? class Notifier < ActionMailer::Base default_url_options[:host] = APP_DOMAIN def email_blast(user, subject, message) subject subject from NOTIFIER_EMAIL recipients user.email sent_on Time.zone.now body :user => user.first_n...

no such file to load -- for several gems unpacked in a Rails 2.3.8 app

Hi, I unpacked several gems into the /vendor/gems folder, and I get the same error message for 5 of these gems when I try to start my Rails application. The date-performance one as an example : no such file to load -- date_performance.so /opt/ruby-enterprise-1.8.7-20090928/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_o...

Creating records using RJS in rails

Hey Everyone, so I've watched http://railscasts.com/episodes/43-ajax-with-rjs but I have a question: In my view I have the following: <div id="testly"> <%= render :partial => "test" %> </div> This works. Using create.rjs to change the content in this div, I have the following in my create.rjs file: page.replace_html :testl...

Getting JSON back from rails with respond_with

I have a jquery ajax call that goes to the create action, and I need to get the response back as JSON to then do something with it on the page in the success ajax function, but for some reason with rails it keeps throwing a missing template error: class MembersController < ApplicationController respond_to :json def create @memb...

Running rake migrate gives Mysql error schema_migrations.frm

I am running 5.1 on Ubuntu 10.04, and the remote server is running 5.0.51, is this a problem? Mysql::Error: Incorrect information in file: './user/schema_migrations.frm': SELECT version FROM schema_migrations I should say that trying to install it gives the error of the package (mysql-server-5.0 referenced but not available). I believe...

Rails - Accessing model class methods from within ActiveRecord model

I have a simple standalone model that doesn't inherit from ActiveRecord or anything else, called SmsSender. As the name suggests, it delivers text messages to an SMS gateway. I also have an ActiveRecord model called SmsMessage which has an instance method called deliver: def deliver SmsSender.deliver_message(self) self.update_attri...

Are there any drawbacks to using helper :all in Rails

In Rails 'helper :all' makes all your helpers 'available' to all your controllers. This is concise and convenient, but does it have any memory and/or performance implications compared to explicitly calling the helpers that each controller actually needs? It's unclear form the docs whether using it involves 'require'ing all those files,...

Setting up restful routes as a total newb

I'm getting the following error: Unknown action No action responded to show. Actions: activate, destroy, index, org_deals, search, and suspend Controller: class Admin::HomepagesController < Admin::ApplicationController def org_deals @organization = Organization.find(:all) end Routes: map.root :controller => 'main' map.admin...

What are the disadvantages of AJAX on Rails?

Hi All, what are the scenario's where Ajax could not be used in Rails Application. Is there any disadvantages of AJAX (AJAX on RAILS) if yes please mention which are they? ...

What do I need to change to get this 'acts_as_rateable' Rails plugin working with this code from the Foundation Rails 2 book??

Hello! I'm working my way through the 'Foundation Rails 2' book. In Chapter 9, we are building a little "plugins" app. In the book, he installs the acts_as_rateable plugin found at http://juixe.com/svn/acts_as_rateable. This plugin doesn't appear to exist in 2010 (the page for this "old" plugin seems to be working again...it was down wh...

How to begin working with git?

I'm a Ruby on Rails developer and want to use Git for my next project, but I'm not pretty sure how to begin learning this. I have too much basic questions like "Can I run my app from the repository?", or "Can I make a rollback in the live site?" Any help will be apreciated. ...

rails server side to upload file from jquery-html5-upload?

I'm trying to use this plugin: jquery-html5-upload http://plugins.jquery.com/project/jquery-html5-upload and it's working but i don't know how to get the file and save it on the server on the rails action. in my rails log i just get this: ... 7?\021\b\000\034\000%\003\001\021\000\002\021\001\003\021\001\377?\e\000\000\001\005\001\001\...

Ajax Request using Rails and jQuery Problem

Hi, I have a favourite and un-favourite functionality in my application and I am using jQuery. This functionality works partially. The page gets loaded, and when I click the 'favourite' button(it is inside add_favourite_div element), it sends a XHR request and the post is set as favourite. Then a new div called "remove_favourite_div" rep...