I've posted a couple other questions during this process, but I have a better idea of what I'm trying to do so I thought I'd ask about that.
I've inherited a Rails 2.2.2 application, which is currently running in production form on a server I have access to. I'm trying to port that application over to my server, version control, etc. I ...
I have a number of models that need the same scope. They each have an expiration_date date field that I want to write a scope against.
To keep things DRY, I'd like to put the scope in a module (in /lib) that I'll extend each model with. However, when I call scope within the module, the method is undefined.
To work around this, I use c...
Hi,
I'd like to know if it's possible to create a complete website using node.js (just like we do using Sinatra and Rails).
Also, is there any framework as good as Sinatra and Rails?
Is this the best use for node?
Regards.
...
I have an array of hashes, and the values are all float numbers.
What are some good ways in Ruby to convert them all to int?
I have this way right now but wonder what other methods there are that are more elegant or clear:
analytics.map {|e| e.keys.each {|k| e[k] = e[k].to_i}; e}
Update: this is a run of the code:
> @analytics = [...
Hi,
What are the best uses for these 3 languages/frameworks? Is it useful to mix all of them (or 2)?
...
Is there some sort of find_by_sql equivalent for mongoid, where you pass a mongo query and it materializes Mongoid::Document s from the results?
...
Hi,
i started using oauth2 gem by intridea (http://github.com/intridea/oauth2) and don't know how to fix this problem. I have developed both client and server and on request for access_token i see no grant_type parameter. My code from client callback controller
class CallbackController < Devise::OauthCallbacksController
def accounts
...
I'm trying to modify the default deserialization of the built-in timestamp format, to affect Ruby's Time.
I do this (successfully) with Hash:
YAML::add_domain_type('yaml.org,2002', 'map') { |t, v| nil }
YAML::add_domain_type('ruby.yaml.org,2002', 'hash') { |t, v| nil }
hash = { :hello => :world }
puts YAML::load(hash.to_yaml) # nil
B...
Hi All,
How will I do authentication using Rails 2.3.8 using MongoDB and
mongo_mapper?
Let me know your expert advise on this.
By the way, a Rails noob here :)
Thanks!
...
I've found this method here.
start = DateTime.now
sleep 15
stop = DateTime.now
#minutes
puts ((stop-start) * 24 * 60).to_i
hours,minutes,seconds,frac = Date.day_fraction_to_time(stop-start)
I have the following error:
`<main>': private method `day_fraction_to_time' called for Date:Class (NoMethodError)
I've checked /us...
Given
class Category < ActiveRecord::Base
has_many :products, :order => 'name ASC'
end
Using the Rails 3 stack, how can I query for all categories that 'have' products?
...
> Hash[:a,2,:b,4]
=> {:a=>2, :b=>4}
> Hash[:a,1]
=> {:a=>1}
> Hash[[:a,1]]
=> {}
> Hash[[[:a,1]]]
=> {:a=>1}
...
Did to_json get removed or something?
...
Hi,
Trying to write a basic "blog-like" app in rails 3, I'm stuck with associations. I need the create method save the post_id as well as the user_id in the comment table (which I need in order to retrive all comments written by a user in order to display it)
The app has users (authentication - devise), posts (posted by users - but I'm...
I am writing a small, really simple lisp parser in ruby with the treetop gem just to experiment with it. However, it is not really working out how I want it to, and the documentation is pretty poor so it's hard to understand what I am doing wrong. Currently, the grammar can match both a symbol and a boolean, but not a number. However, wh...
Is there a command line switch I'm missing?
At the moment I'm having to do this:
#task :install => :build do
task :install do
end
...
Hi
I was just wondering how i can wait for a hidden element to appear on the page,
i triedni seleum.is_element_present but it dosent seem to be working.
thanks
...
I have a large set of MIME files, which contain multiple parts. Many of the files contain parts labelled with the following headers:
Content-Type: application/octet stream
Content-Transfer-Encoding: Binary
However, sometimes the contents of these parts are some form of binary code, and sometimes they are plaintext.
Is there a clev...
I'm using Watir and Ruby to try and slurp a load of data from a web application into a hash:
def getOrders( )
return orders = slurpOrders()
end
def containsOrderNumber( orderNumber )
puts orderNumber
orders = getOrders
puts orders[orderNumber]
#puts orders.keys
puts "orders has_key? = " + orders.has_key?(ord...
Hello,
I have updated to rails 3 on my Snow leopard. Previously i use sqlite for development.
It's working fine when i rake db:create.
Now I'm trying to install mysql on my mac.
I downloaded mysql-5.1.50-osx10.6-x86.dmg
Installed all three file.(mysql-{version}-osx10.5-x86.pkg, MySQL.prefPane, MySQLStartupItem.pkg)
execute this to in...