When running one of my app's functional tests the other day I hit a bug in my code that was causing a RoutingError. My functional test was loading a page and in that page it was creating a link to a page that had no valid route to it. The specific cause of the exception is not the point though - the problem was that this exception was ...
Hi,
Currently for sending rails emails we use google apps for our emails, but we're limited to 500 emails/account/day.
I was wondering if there's any way to track how many emails we're sending, and then switch accounts if needed - as in, if we're under 500 emails for the day, use account 1, and if we've hit 500, use account 2, If we hi...
I have a rails app that needs to start a supporting Sinatra web service. I would like to invoke it via a rake task. But I want the Sinatra app to start inside a new terminal (command) window. Yes, I need to see it executing.
# rake task
namespace :daq_controller do
desc "start the DAQ contoller web service"
task :start do
dir =...
I'd like Textmate to highlight Ruby syntax inside <% %> tags in *.js.erb files (like it does in *.html.erb files). Right now it looks like this:
As you can see, everything within the quotes is treated like a regular JS string – annoying.
...
Hi,
Say I have a blog post with comments in rails, how do I clone it so I have another blog post with comments, both stored as new objects in the database with their own ids?
I know about the clone command, but it doesn't seem to copy over the comments - only links to them.
Is there a plugin or an easy way to do this in rails?
Thanks...
Alright, so the ultimate goal here is to parse the data inside of an xml response. The response comes in the format of a ruby string. The problem is that I'm getting an error when creating the xml file from that string (I know for a fact that response.body.to_s is a valid string of xml:
<?xml version="1.0" encoding="UTF-8"?>
<Response...
Let's say I have the following tables:
TAGS
id: integer
name: string
POSTS
id: integer
body: text
TAGGINGS
id: integer
tag_id: integer
post_id: integer
How would I go about writing a query that select all posts that are tagged with ALL of the following tags (name attribute of tags table): "Cheese", "Wine", "Paris", "Frace", "City"...
Let's say I have the following tables:
TAGS
id: integer
name: string
POSTS
id: integer
body: text
TAGGINGS
id: integer
tag_id: integer
post_id: integer
How would I go about writing a query that selects all posts in order of the post containing the highest number of the following tags (name attribute of tags table): "Cheese", "Wine...
Can someone please explain the following, with example urls? thanks a bundle! (a gem bundle!)
resources :products do
resource :category
member do
post :short
end
collection do
get :long
end
end
Resources maps all the routes in the ProductController right? How is category embedded?
match 'products/:id', :to => 'ca...
What are the factors you would consider when choosing between Socket.io and Pusherapp?
http://Socket.io
http://pusherapp.com
Important considerations includes: integration w existing systems like rails/django, ease of setup, ease of development
...
I seem to be having trouble testing the slick javascript things I do with jQuery when using Capybara and Selenium. The expected behavior is for a form to be dynamically generated when a user clicks on the link "add resource". Capybara will be able to click the link, but fails to recognize the new form elements (i.e. "resource[name]").
...
I have a model, say User. I want to call /users (users_controller#index) and pass it basically a scope so it returns data based on:
The format (js, json, html)
The chart/grid/layout it will be rendered in (highcharts, basic html table, jquery flexigrid, etc.)
With inherited_resources and has_scope, you can do something like that but...
I have a model that handles all my uploads of different filetypes.
How do I create a style with the same name as the :basename so that the url will be the same for images and non-image files?
...
When using RVM with ruby 1.8.7 I am unable to run the debugger. I am using rails 2.3.9 and mongrel
script/server --debugger
returns:
You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
this is what my gem list looks like:
ruby-debug (0.10.3)
ruby-debug-base (0.10.3)
...
I have this setup:
class UsersController < InheritedResources::Base
respond_to :html, :js, :xml, :json
def index
@users = User.all
respond_with(@users)
end
end
Now I am trying to make it so, if params[:format] =~ /(js|json)/, render :layout => false, :text => @users.to_json. How do I do that with respond_with or respon...
This Twilio API Sample code isn't working in Rails 3:
#voice_controller.rb
def reminder
@postto = BASE_URL + '/directions'
respond_to do |format|
format.xml { @postto }
end
end
#reminder.xml.builder
xml.instruct!
xml.Response do
xml.Gather(:action => @postto, :numDigits => 1) do
xml.Say "Hello this is a cal...
Installing an old project on a new computer.
If I type :
$> rake db:migrate
It returns:
uninitialized constant Geocode
/Users/macuser/Sites/hq_channel/vendor/rails/activesupport/lib/active_support/dependencies.rb:443:in `load_missing_constant'
...
I sudo gem install'd all the gems that were in the environment.rb..
I did a rake ge...
I get the following output from the sudo bundle install command:
Fetching source index for http://rubygems.org/
Could not reach rubygems repository http://rubygems.org/
Could not find gem 'rspec-rails (>= 2.0.0.beta.22, runtime)' in any of the gem sources.
I have $http_proxy set correctly and I've added gem: --http-proxy=my proxy to ~/...
I'm incredibly new to Rails and programming in general. Built my first, fairly static, Rails app. I have 100's of products (specifically t-shirts) that all have associated colors (RGB values) and sizes that I need to display on several product pages.
Rather than hand-coding this information, I assume I need to build a database for it. ...
I am trying to design my ruby on rails app at the moment. I created views/layouts/posts.html.erb which styled my PostsController's views.
I want to add a main bar that is always at the top of the page no matter what view the user is looking at. I thought this was what the views/layouts/application.html.erb was for.
This seems to agree ...