I'm building a Rails plugin that extracts a lot of data from Rails apps. It builds queries dynamically that span multiple tables, and there will be a lot of results returned. Here's an example of one of the queries built for pulling purchase data out of a Spree (Rails shopping cart):
select orders.user_id as from_id, variants.product_id...
Hiya,
I have no idea what I have done here, but I have attempted to get one controller in Rails to queue a job onto Resque, which then a worker connects to and does the heavy lifting (I.E. comparisons, database entries).
However, the tasks are not even running, since there are no clear instructions for setting Resque up.
Copy and paste'...
class CustomerClass < ActiveRecord
class << self
attr_reader :lov
end
attr_reader :lov1
end
What is the diffrence between attr_reader lov and lov1 ?
...
I am using Ruby 1.9.2 and i have an assignment to use hpricot. I have tried to install hpricot gem and I get error messages. extconf.rb failed. Could not create makefile. Check the mkmf.log. But I cannot find mkmf.log.
I checked the other answers and tried to install using gem install hpricot-platform=mswin32. that didnt work either.
...
Possible Duplicate:
What is the difference between include and require in Ruby?
require File.join(File.dirname(__FILE__), 'load_test_data.rb')
require 'find'
require 'fileutils'
include CommonValidators
Can someone please give me proper example to understand the difference between require and include?
...
Is there a way to implode an array in Ruby to combine all elements into one string?
Example Array:
@arr = ['<p>Hello World</p>', '<p>This is a test</p>']
Example Output:
<p>Hello World</p> <p>This is a test</p>
Thanks in advance!
...
I'm using refinerycms in our site to let the less technical staff update content. Inside the gem, they have a Page class that maps each top level page on the site. I'd like to use the acts_as_taggable gem on this Page class. Now I can add the acts_as_taggle declaration directly to the page.rb file, but then I'd have to maintain a separat...
I am trying to show a rails view file in a textarea. the view file contains a bunch of HTML, which I want to escape so that it does not interfere with on page html. here is an example:
In this view we are going to display the contents of a partial
<textarea>
<%= html_escape render('partial') %>
</textarea>
and in partial.html.erb I ...
Hello.
I'm creating a very simple timeshare application using Sinatra and Datamapper. Every user in the application will have n reservations and for the time being each reservation runs from Monday to Sunday and there can only be one reservation per week.
Now I will need a view with a textbox (and label) for each week of the year where ...
Apparently, I am using params[:category] (from routing...) to categorize some articles within same table, and I just want to set the category column of an article to be params[:category]. I tried just saying
class Article < ActiveRecord::Base
has_many :comments
belongs_to :article_category # this is the model that has info about ca...
I'm trying write a Ruby script that checks if user credentials are valid using an active directory server. Here's what I've tried so far:
require 'rubygems'
require 'net-ldap'
host = '10.4.1.6'
port = 389
username = 'username'
password = 'password'
ldap = Net::LDAP.new
ldap.host = host
ldap.port = port
ldap.auth "CN=#{username},CN=Us...
Is there a synchronized exec in ruby? I try the following code and when I open the file I get nothing, and it's probably because exec doesn't finish writing the file.
exec "sort data.txt > data.sort"
File.foreach("data.sort") { |line| puts line}
Ted
...
I'm trying to connect from Ruby 1.8.7 on RHEL 5 to MS SQL Server. I'm using FreeTDS and the tiny_tds RubyGem.
I got it working fine on OS X.
On Linux I installed FreeTDS and confirmed that it can connect to SQL Server from the command line no problem. And gem install tiny_tds went fine.
However, when I deploy to Linux and try to open ...
I updated to Rails 2.3.10, Rack 1.2.1 and now none of my flash messages are showing up. I found that during a redirect the notice is passed in like this
redirect_to(@user, :notice => "Sorry there was an error")
And in my view the flash hash is empty
<%= debug flash %>
!map:ActionController::Flash::FlashHash {}
But you can see t...
I've run into a lot of issues whilst attempting to install RVM on Ubuntu 9.10. Here's the steps I've tried doing:
install ruby (via ruby site, no package manager)
download rvm
install rvm (make edit to .bashrc)
use rvm to install ruby version & gems
Is there any crucial step that I seem to be missing?
...
In authorize.net I used active merchant gem but activemerchant not support Prolific Payment Gateway. please suggest me a gem or way.
...
I am new to programming (previously only did html/css/design) trying to start learning RoR via the book Simply Rails 2. However I want to start with the most recent versions of Ruby(1.9.2) and Rails (3) so I am forced to get everything configured without the book. I have looked a lot via google and on stackoverflow. When I run rails serv...
I'm running multiple versions of Ruby (and Rails) on Windows and use Pik to switch between them. At the command line, I'm able to call
> pik list
186: ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]
192: ruby 1.9.2p0 (2010-08-18) [i386-mingw32]
to get a list of ruby versions available, and use
> pik 192
> ruby -v
ruby 1.9.2p0...
I currently have below lines for application_controller.rb. Basically, I am using session to check whether user has logged in or not, including authentication. I just used a term m
class ApplicationController < ActionController::Base
protect_from_forgery
protected
# Returns the currently logged in member or nil if there isn't on...
Hey!
So i just got devise and fb login to work on my rails project, but I would like to get more info about the user when they log in. I added user_about_me to the scope of the request and that got me a lot of info, but I would also like to get the users music/movies/etc. I tried adding user_interests but it doesnt seem to send anything...