I have a jQuery function that updates my data ever few seconds.
But! It's not parsing the javascript it's loading. It just calls it appropriately every few seconds, and replaces my content with unparsed javascript code.
setupMediaIndexPoller: function(organization) {
url = '/organizations/' + organization + '/media/photos_and_video...
I'm starting out with Ruby and was wondering if there's an interactive console similar to Python's IDLE, you know, with context highlighting and autocompletion. I've tried IRB, but it's fairly spartan (although it gets the work done; no question about that). Googling hasn't helped. You guys have any suggestions?
...
I've been developing a web application and a lot of customers are asking if they can host the application in their network (for security reasons). I have been looking for a way to package up a rails app into a single executable (with server and all), but haven't been able to find anything. My other requirement is that we distribute it ...
Hey everyone,
I have a quick question on retrieving information from a hash, here is the code thus far:
permits_sheet.each do |row|
rate_type = row[0].to_s #Converts the rate type (title) to a string
row.shift #Removes the title from hash so it's not added to values
row.each do |values|
split_value = values.split ('=') #Refer...
I'm using ruby 1.8.7 and I need to compare two hashes that I have, which are essentially the attributes of a model. Hash A is smaller than Hash B, and Hash B has all of the attributes of hash A, plus some extra attributes I don't care about. My overarching goal is to see if the elements of A are the same as the respective elements of B...
Hey,
I'm trying to save a hash of options in a single DB field. The form is able to save the data to the DB but not able to retrieve it again when I go to edit it (e.g. all the other fields are prepopulated except for the wp_options fields).
class Profile < ActiveRecord::Base
serialize :wp_options
end
This is my custom class:
...
In the Rails 3 app that I'm building to help me learn Ruby on (and) Rails, I'm a bit confused by the "roles/roles_users/users" tables.
I have Devise and CanCan and I want to "access" these roles.
Right now, I have three roles:
admin
staff
client
In the database, I have these tables (and a few others):
roles (table)
id => 1 || name...
I have the following code:
File.open("/log/#{hostname}-#{@tdate}-errors.txt",'w') do |o|
run=tn.cmd('String'=>'sh int', 'Match'=>/#/) { |c| puts c}
run.each_line do |re|
title = re.match /([\S]+)Ethernet\S+/
rep = re.match /\d+ input errors/
#o.puts run
o.puts title
o.puts rep
end
end
tn.close
It writes t...
I'm looking at implementing IP Address filtering for my Rails SaaS app. In a nutshell I want administrators to be able to specify one or more IP Addresses (or a range of IP Addresses) and then my app only accept requests on their instance from the specified addresses.
I'm looking at using IPAddress (http://github.com/bluemonk/ipaddress)...
Anyone know of a better XMLRPC testing program for ruby?
...
if the code is
do_more ||= true
then when false is passed in, it becomes
do_more = false || true
and therefore will still be true. So this is one case where foo ||= default_value won't work? In this case it will need to be
do_more = true if !defined? do_more
?
...
I got this error:
Could not find gem 'mysql2 (>= 0, runtime)' in any of the gem sources.
Try running `bundle install`.
when trying:
rails script/generate scaffold post title:string
I am on a mac osx, rails 1.8.7, 3.0
...
I have some questions about non-blocking IO:
If I use Ruby without EventMachine on Nginx, could I leverage non-blocking IO?
If i use Ruby with EventMachine but on Apache, could I leverage non-blocking IO?
If the above answers are no, then it means I have to use Ruby with EventMachine on Nginx to leverage non-blocking IO?
...
I just installed the Phusion Passenger webserver via gem install. I then did a gem check --alien and got this error message:
fastthread-1.0.7 has 3 problems
.require_paths:
Extra file
ext/fastthread/Makefile:
Extra file
lib/fastthread.rb:
Extra file
passenger-2.2.15 has 5 problems
.require_paths:
Extra file
ex...
Hi,
I am trying to create a poll, which has many choices. While creating the poll, I am getting the "Poll can't be Blank" Error. Poll gets created when I removed the choices fields from the form
Poll.rb
class Poll < ActiveRecord::Base
belongs_to :profile
has_many :choices, :dependent => :destroy
accepts_nested_attributes_for ...
Just created a new blog app using rails 3.0
my model is simple:
class Post < ActiveRecord::Base
has_many :comments
end
class Comment < ActiveRecord::Base
belongs_to :post
end
I used the commands: rails generate scaffold post title:string body:text etc.
to create these files.
Now I wanted to generated the db using:
rake db:cre...
Which IDE is more superior for Ruby development? Aptana or Netbeans? Also, is there any IDE to date that is better than the two?
...
I've heard that you have to use non-blocking code throughout the application to be able to harness true power of EventMachine.
Does this mean I can't run Ruby on Rails with EventMachine?
...
I have the following text which will always follow the same format:
1
"13"
"241"
"Rabun"
"06"
"County"
2
"13"
"281"
"Towns"
"06"
"County"
I would like to assign each section to a hash like:
locality= {:id => "", :fips1 => "", :fips2 => "", :county => "", :stateid => "", :type => ""}
How would I go about doing this in R...
For example:
ruby-1.9.2-p0 > a = ['hello', 'world']
=> ["hello", "world"]
ruby-1.9.2-p0 > "foo" + a
TypeError: can't convert Array into String
from (irb):3:in `+'
from (irb):3
from /Users/peter/.rvm/rubies/ruby-1.9.2-p0/bin/irb:17:in `<main>'
ruby-1.9.2-p0 > "foo" + a.to_s
=> "foo[\"hello\", \"world\"]"
ruby-1.9.2-p0 ...