I'm working on adding fragment caching to a Rails 3 site that has both logged in and anonymous users, and need to control when parts of the page expire based on when content displayed throughout the site is updated. Midway into this, I discovered that memcached doesn't support regexps for expire_fragment, so now I'm looking for ways arou...
Hey guys,
So im trying to get image cropping to work on Amazon S3, I have the following function
def update_attributes(att)
scaled_img = Magick::ImageList.new(self.photo.to_file)
orig_img = Magick::ImageList.new(self.photo.to_file(:original))
scale = orig_img.columns.to_f / scaled_img.columns
args = [ att[:x1], att[:y1], att[:...
Hi,
I need to display the current selection for select table as a pop up box , where in index.rhtml I have this
<SCRIPT LANGUAGE="JavaScript">
function checkData()
{
var myTest = formid.table_id.options[formid.table_id.selectedIndex].value;
alert 'myTest';
}
</script>
<% form_tag :controller => 'project_controller', :action => 'actio...
Suppose we have a textarea in which we put example string. Textbox contain :
Earth is revolving around the Sun.
But at the time of saving, I just pressed a enter key after "the sun". Now the statements in texbox ::
Earth is revolving around
the Sun.
Now I am trying to fetch the data but unable just because of that enter key press...
I've got an application I've been working on with ruby 1.9.1. I'd like to test the javascript in my UI and the default selenium driver for capybara doesn't support the events I need to test.
So I'm going through the process of using rvm to switch the application on to jruby for testing, since apparently celertiy/culerity only work on j...
Is it actually common practice to extend all methods of a Gem into the application controller in Rails?
Because it seems that Facebooker gem doesn't that, and there is no telling whether the method is from the facebooker gem, or from our internal code.
So when we need to upgrade to Facebooker2, it is hard to find all methods that are a...
In rails 2 there was a private method on active_records called create_without_callbacks which you could call to save a record into the database without triggering the callbacks associated with that object. This method has disappeared in rails 3, is there any way to achieve the same thing?
...
Hello.
I write web-GUI for application and must (!) using names for columns such as 'delete' or 'listen-control' and so on.
I find this code but it is dated by 05 Aug 2005 and not works with Rails 3.
How can I redefine this names using native Rails mechanism? Is it possible?
PS I'm know about problem with hyphens in the Rails.
PPS ...
Ok so I am using some module/lib/plugin (not sure of the exact name), let's say its a authentication/authorization plugin like: http://github.com/technoweenie/restful-authentication
class HomeController < ApplicationController
some_module_name_here
end
Now just from adding the code above 'some_module_name_here', I can access t...
On Github, I can send a page link with a file of code. Does Heroku have the same functionality, or do I have to have them clone the project and added as a collaborator to do that?
...
I think it's a best practice to embed replies to a specific message inside that message and I'm trying to implement it using mongoid. here is what I have
class Message
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Paranoia
field :subject
field :body
field :sender_deleted, :type => Boolean, :defaul...
I want to create a command line based tool for PHP Development.
It should do something quite similar based on what the rails generator does as well as integrate with rake, as the rake tasks for the DB should also be available.
Or is there a ruby framework that allows to build such generators?
...
Version 2.3.4
Let's say, I have an items table with some fields, for example: id, name, something, created_at, updated_at, is_dirty. I'm using active scaffold to display a HTML table from it.
class ItemsController < ApplicationController
layout 'application'
active_scaffold :item do |c|
c.columns = [ :id, :name, :something ]
...
It seems that we will need 2 methods, one is CGI.escape and the other might be h (unless we hardcode &.
Is there a method that takes an array or hash of params, and compose it into this form?
src="foo.php?href=http%3A%2F%2Fexample.com%2F&layout=standard"
It is for Rails 2.2.2, so if there is a method in Rails 2.x that can do ...
Hello,
I assume this one is rather a JavaScript/jQuery/DOM question than a Rails question, but it's all due to the way I implemented it in Rails.
I am trying to upload files while creating a new object (auction). While the user inputs some data, he shall also have the possibility to upload multiple photos.
The main problem is, that th...
Hi,
I am trying to build a quiz of sorts. I would like my form to be able to build one question with 4 or more answers. 4 answers are inputted by default with the ability to add more answers dynamically with javascript. I have modeled it off the code in Ryan Bate's railscasts "Nested Model Forms".
My dilemma comes with setting the ...
I can't believe I've been looking four hours for this simple task, but I have.
In Rails 2.3, I could replace one section of a page with this simple code:
render :update do |page|
page.replace_html "div_id", :partial => "new_content",...
end
In Rails 3, Ryan Bates has me writing entire new javascript functions, switching from Protot...
I have an Object where the object has a nested form of which can be duplicated as needed.
To accomplish this I am using :
- 2.times { @organization.referrals.build }
- form_for @organization do |f|
= f.error_messages
- f.fields_for :referrals do |qf|
= render :partial => 'referral_fields', :locals => {:qf => qf}
Now I have tw...
I was trying to install sqlite3 interface for ruby in my Ubuntu 10.10.
But i got the following error any suggestions ?
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
extconf.rb:3:in `require': no such file to load -- mkmf (LoadError)
from extconf.rb:3
...
Hello all,
Here is how I build the report, the problem is that we do not know how to pull the segment data for non-paid traffic - please advice. Thanks
report = Garb::Report.new(profile,
:limit => 10,
:sort => :visits.desc,
:start_date => (Date.today - 30),
:end_date => Date.today,
:segment => {:segment_id => "-5"...