How can I profile a controller action? One of my views is taking quite some time to render and I'd like to break it down. I see script/performance/profiler, but that seems to only have access to the global scope.
...
Need a simple a way of rounding off an Image. I need the corners to be transparent. This link shows how to do it via command line:
http://www.imagemagick.org/Usage/thumbnails/#rounded
What I need is the corresponding RMagick\Ruby code... Thanks!
...
This is what I'd like to achieve:
User input URL (http://google.com for example)
GET the page, and render it on my own domain
Traverse the DOM (Using JS) and all that jazz
The problem is I don't want to use an iFrame, because then I can't traverse the DOM of the page loaded.
The only solutions I can think of is to parse the page for...
i just installed MAMP on this iMac and the rubygems but when i run:
sudo gem install mysql — –with-mysql-config=/usr/local/mysql/bin/mysql_config
gives me
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Ver...
Hey,
please help me to understand something. In Authlogic example in UsersController it's always used @current_user, so for instance:
def show
@user = @current_user
end
(taken from http://github.com/binarylogic/authlogic_example/blob/master/app/controllers/users_controller.rb)
Why is that? In my controllers I use just current_user...
I have a simple model setup in my Ruby on Rails app. (User {name, username, lat, lon}) and am writing a basic extension to the model. I would like the method to return users within a certain distance. It all works just fine in the page view, but as I am debugging I would like to work through some testing using the script/console.
My ...
i have an RoR application Log, which similar to the book store app, my logs_controller has all default action: index, show, update, create, delete..
now i need to add new action :toCSV, i defined it in logs_controller, and add new route in the config/routes as:
map.resources :logs, :collection => { :toCSV => :get }.
from irb, i check...
I'm trying to figure the best way to query a date range from rails...I looked around on Google but am unsure about how to use this syntax.
I have a Model that has various events and I like to add to my find condition a caveat that should only show events where the field :st_date is today or later, in effect only show me data that is cur...
I'm using Rails 2.3.2 and using Paperclip to upload photos. I'm also using a slightly customized subdomain_accounts.rb to set some account-specific variables. My question is this:
How can I set the bucket used in Paperclip to be dependent on the current account? Since this looks to be a model attribute set up early on, how can I overri...
I am in the process of building a rails/flex application which requires audio to be recorded and then stored in our amazon s3 account. I have found no alternative to using some form of RTMP server for recording audio through flash, but our hosting environment will not allow us to install anything like FMS, Red5, etc.
Is there any existi...
I am running RoR, Ruby 1.8.6/Rails 2.3.2.
I am persisting a String within a model object to MySQL to a Blob field. For a number of reasons, I have to use MySQL Blob data type instead of a Text data type, yet I want Rails to treat the field as a regular String (instead of a binary String - which is what I think it is doing?).
How can I...
I'm adding some columns to one of my database tables, and then populating those columns:
def self.up
add_column :contacts, :business_id, :integer
add_column :contacts, :business_type, :string
Contact.reset_column_information
Contact.all.each do |contact|
contact.update_attributes(:business_id => contact.client_id, :business...
RoR allows you to, as long as the env is development, change parts of the your application code and then just refresh the browser--and everything is changed, without having to restart Mongrel.
How does this work, and where in the Rails codebase is this done?
(Or, alternatively, is there some easy way to do this with Rack+Mongrel?)
Tha...
I have a number of activities that have a calculated scheduled date. The activities, for example, Email, have a email.days method which is the days from a Contact.start_date on which it should be sent.
This means contact.start_date + email.days yields a date on which email is sent to contact.
I would like to use link_to around the dat...
Problem
The form_for helper incorrectly determines the path to my nested resource inside of a namespace. The models in question are: Forum::Thread and Forum::Reply respectively, located in a subfolder called "forum" under my models directory. This is in Rails 3 BETA 3.
routes.rb
namespace :forum do
root :to => 'threads#index'
...
I have a parent-child relationship between two objects.
Parent :has_many :children
Child :belongs_to :parent
When creating a new parent, in the same controller, I'm creating the child.
@mom = Parent.new
@child = Child.new
@mom.children << @child
That all seems to go okay, but this parent has one more attribute - this parent has a ...
When should you use ActiveRecord's composed_of class method?
...
Hi,
My link_to tag is:
<%= link_to("My test title",{:controller=>"search", :action=>"for-sale", :id=> listing.id, :title => listing.title, :search_term => search_term}) %>
and produces this ugly URL:
http://mysite.com/search/for-sale/12345?title=premium+ad+%2B+photo+%5Btest%5D
How can I get link_to to generate:
http://mysite.com/...
I have a Rails website which has been divided into two separate projects - the public site, and the administration site.
As both sites are using the same database the models are shared between the applications (actually right now they are duplicated). The problem I have here is that when an update to the models occurs in the public proj...
EDIT:
Got too confusing with so many different edits, so this is where I'm currently at.
I have a HTTPService in my Flex 4 app defined as follows:
<s:HTTPService id="getUserDetails" url="http://localhost:3000/users/getDetails" method="GET"/>
I call this service like this (note: I've checked the network monitor in Flash Builder 4 and...