Hi All,
I'm having a bit of an odd issue. Really too odd to type out, but here goes. Basically I have a controller that refuses to "respond_to" using javascript unless I assign my "chart.generate_xml" to a variable before the "respond_to" block like so:
@xml = @chart.generate_xml(@begin_date,@end_date,1.hour)
respond_to do |forma...
I have a form with an ever-growing amount of associated javascript. At present this javascript lives in my form view which is fine, but it's getting larger and starting to overwhelm the form making it difficult to work on the form.
I want to put this in a separate file in my /public/javascripts directory but a lot of the javascript is g...
I've searched all over web and have not found the answer. I'm trying to have a very standard archive option for my blog based on date. A request to url blog.com/archive/2009 shows all posts in 2009, blog.com/archive/2009/11 shows all posts in November 2009 etc. I found two different of code but not very helpful to me.
def display_by_dat...
I found this code in a Rails cookbook.
class BlogController < ApplicationController
def display_by_date
year = params[:year]
month = params[:month]
day = params[:day]
day ='0'+day if day && day.size == 1
@day = day
if ( year && month && day )
render(:template => "blog/#{year}/#{month}/#{day}")
elsif ( year )
render(:template...
I'm using Rails 3.0.0.beta3 and Haml 3.0.0.rc.2, and I can't find where I need to place the configuration lines for Haml (nor what they are in the new version, for that matter). Using Rails 2.3.5 and Haml 2, I would do
Haml::Template.options[:format] = :html5
in environment.rb. Or, in Sinatra,
set :haml, {:format => :html5}
in my m...
Provided a url, within a string of text (tweet) such as
"Check out my twitpic http://twitpic.com/1876544594 its awesome"
I need a Rails regex that will return 18744594, the id of this particular twitpic...
This question has been asked here but was for PHP, and I need it for Rails.
I would also be able to pull the name of the site, s...
I have a model called List which has many records:
class List
has_many :records
end
class Record
end
The table Record has 2 permanent fields: name, email.
Besides these 2 fields, for each List a Record can have 'n' custom fields.
For example: for list1 I add address(text), dob(date) as custom fields.
Then while adding records to l...
Im trying to get an 'add to cart' button to work. When I use <%= button_to "Add to Cart", :acton => "add_to_cart", :id => @product %> and then click the button, I get a URL that puts the action after the ID, like this: http://localhost:3000/store/show/1?acton=add_to_cart The cart page does not load.
What I need is a URL that looks li...
I have several methods I call from my controllers that feel like they should be pulled out and put into a reusable class, outside of the controller. Where do people usually put this stuff? I know I can put them into my ApplicationController, but that doesn't seem to be a great solution if I think I can use these methods later in other ap...
I sometimes got this error from my log/production.log file:
#<ActiveRecord::StatementInvalid: OCIError: ORA-03114: not connected to ORACLE: select decode(table_name,upper(table_name),lower(table_name),table_name) name from all_tables where owner = sys_context('userenv','session_user')>,
How to solve this? How to rescue this and reconn...
I'm using the following code to retrieve emails from my Gmail inbox.
def get_mail
Net::POP3.enable_ssl(OpenSSL::SSL::VERIFY_NONE)
Net::POP3.start('pop.gmail.com', 995, "uname","pass") do |pop|
unless pop.mails.empty?
pop.each_mail do |mail|
email = TMail::Mail.parse(mail.pop)
email_obj=EmailedQueries.n...
I'm using gvim and rails.vim and getting the following error when attempting to run :Rake from within a migration:
:!rake db:migrate VERSION=20100427002644 2>&1| tee /tmp/v436868/11
/bin/bash/: rake: command not found
I'm not sure how to troubleshoot this. What can I do to fix this?
Edit:
If i run rake --version from the terminal i...
I will use it to do full text search in my ruby on rails app.
which is the best choice.
solr use java to do this job. or sphix in ruby?
...
Hello,
I am looking for ways to protect my product images and I don't know if there's anything out there better than what I've already found: disable right click, use a transparent image in front of your picture and watermarking. Obviously none of them is perfect but I was curious if someone came up with a better solution to this proble...
Consider the following code which is to be thrown at an AR find:
conditions = []
conditions[:age] = params[:age] if params[:age].present?
conditions[:gender] = params[:gender] if params[:gender].present?
I need to add another condition which is a LIKE criteria on a 'profile' attribute. How can I do this, as obviously a LIKE is usuall...
I am going to be away from the internet for a few weeks and would still like to get a project done. What steps should I take to make sure I have access to the things I need (ruby and ROR) while I will be disconnected?
...
I have a rectangular image for example 30x800 pixels
How I can scale it with paperclip to preserve the aspect ratio to a 100x100 pixel image with borders filling the empty area ?
an example : http://www.imagemagick.org/Usage/thumbnails/pad_extent.gif
...
Hi Everyone,
I am making good progress with my first Rails app with a lot of help from the great community here at Stack Overflow.
I have a basic application that has the following models:
kase
person
company
party
I have associated them in the following way:
class Kase
belongs_to :company # foreign key: company_id
has_and_belo...
How can I scroll the page to a partial, which got inserted via rjs?
page.insert_html :bottom, :comments, :partial => 'comment', :object => @comment
...
I am developing an application that resides on a public host but whose source I must keep in a Git repository behind a corporate firewall. I'm getting very tired of the slowness of deploying via scp (copying the whole repository and shipping it over SSH on each deploy) and would like to have the remote host simply do a git pull to update...