I have a string that is defined as one or more dot-separated integers like 12345, 543.21, 109.87.654, etc. I'm storing values in a MySQL database and then need to find the rows that compare with a provided value. What I want is to select rows by comparing each component of the string against the corresponding component of the input strin...
I have a Rails app that is generating duplicate requests for every request in development. The app is running Rails 2.3.5 with my primary development machine running Ubuntu 10.4. However, the same code runs fine without showing duplicate requests on my OS X 10.6 box. It also runs in Production mode on either machine without problems.
...
So I'm trying to use link_to to create a link in my Rails app and trying to add a CSS class to certain links. The problem that I have is that when I add my html options to the link_to arguments, the links don't get created and I end up with nothing. Here's my code:
<%=link_to( image_tag(@beetle.icon_img, :width=>30, :alt=>"Beetle", :bor...
I'm doing a rewrite of an old Rails application and I thought I should do it in a RESTful manner, as a learning experience if nothing else.
I've reached some actions that toggles a boolean value, for example if an article is published or not.
Before I had a couple of actions: toggle_published, publish and unpublish.
They were very eas...
This is dragging at my nerves!
Scenario:
I am using the geocoder plugin: http://github.com/alexreisner/geocoder/
I have two models: Address and Item
the latitude and the longitude are in Address and an Item belongs_to :address
Now, when I try to do a near search:
Item.near(Person.first.address.coordinates, 20)
on an Item it fails with...
I am working on creating a new controller/route to only allow an HTTP GET and HTTP POST. The URL should be to /foo. Naturally my route looks like the following:
map.connect 'foo',
:conditions => { :method => :get },
:controller => "foo",
:action => "display_something"
map.connect 'foo',
:conditions => { :method => :post },
:c...
I have an application App2 to which I am sending a POST request from App1 using ActiveResource.
On the App1,
I have
module App2
class Iteeem # Purposely misspelled here
def self.edit_item
self.prefix "/api/editing_item/"
post :item, {:property => {:value => 5665}}
end
end
end
It hits
h...
Hi, I'm little confused on how to use cuke's options.
I know that I can run spec and cucumber in two different console. But I want it to run both.
So, I can pass args/options for rspec like bundle exec autotest -c -f specdoc but if I pass cucumber options like --tags @wip --format pretty, it blows out.
So, how can I accomplish this??
...
Hi,
I'm using the Juggernaut plugin in a rails application.
http://github.com/maccman/juggernaut_plugin
I can't find how to disable the alert() when running my app in Firefox.
Any Ideas ?
...
I just finished a rails app that I want to host on BlueHost. Its given me issues. I am told I ve to apply for SSH Access but I am in Ghana. So I don't know! can anybody help me
...
I am working on some code today but for some reason I can't seem to get it to work. Some explanation:
I have a system that contains feeds, that consist of feed_entries. There are also some categories with sub_categories. Between the sub_categories and feed_entries there is a has_and_belongs_to_many relationship, which I can not seem to ...
I have configured Rails to run with Multi Master Manager for Mysql (http://mysql-mmm.org)
We also have a load balancer to distribute the DB request, so here is the setup:
rails
|
load balancer (LB)
/ | \
db1 | db2
\ | /
MMM
If one of the db is down, everything is fine, MMM...
I followed these instructions, installed passenger, but the web page is still not resolving to the ruby app. It just shows the files. Please help!
http://wiki.github.com/teambox/teambox/installing-on-ubuntu
...
Hi all. I'm trying to send out some mails from the console on my production server, and they're not going out. I can't work out why. I have just your standard email setup with sendmail. When i call the Mailer.deliver_ method i get this back:
#<TMail::Mail port=#<TMail::StringPort:id=0x3fe1c205dbcc> bodyport=#<TMail::StringPort:id=0x...
I am trying to figure out an odd issue I am seeing where a reload! in console appears to solve an issue.
I have an AccountObserver class that should run an after_create method whenever a new Account instance is created. The after_create method creates a Resque job.
When I first load console, create a new Account instance results in ...
Could someone please explain for me what is happening here?
i feel like the documentation doesnt mention a lot or describe what is happening. it just say use this method like this.
what will happen if username and password are true, what will happen if false etc?
class AdminController < ApplicationController
USERNAME, PASSWORD = "hu...
I have a simple models
class Item < ActiveRecord::Base
has_many :parts
end
class Part < ActiveRecord::Base
belongs_to :item
default_scope :order => :index
end
Each part has it's own index, to be ordered inside of the Item in question.
When i load parts for the item in ItemsController.show method, the parts are not ordered.
...
I have two classes, Event and LivingGroup. LivingGroup has_many Events so I made the following additions to my _form.html.erb for LivingGroup:
<div id='event_children'>
<% f.fields_for :events do |event_form| %>
<%= render :partial => 'event', :locals => { :f => event_form } %>
<% end %>
</div>
<p>
<%= add_child_link 'Add Ev...
So I want to do this:
save_to_library(params) if params[:commit] == "lib"
but save_to_library apparently doesn't take any arguments.
how do actions get params if they don't take arguments?
(I know this action works when I link to it directly... just trying to streamline usability)
...
I'm having trouble figuring out how best to model my data. I have the following two models in my Rails application:
class Foo < ActiveRecord::Base
belongs_to :active_bar, :class_name => 'Bar'
accepts_nested_attributes_for :active_bar
before_create do |f|
f.active_bar.foo = f
# Causes stack overflow!
f.active_bar.save...