in my rails app, I have an Organization model, with a reference to a User, which I want to be able to access via organization_instance.adminstrator. I'm not sure how to accomplish this using the belongs_to method.
...
I need to build an internal service that queues the DB for changes (in one table) every one second, and processed data after this event.
I do not need all the Rails stack since this service does not need the Controller/View functionality. Basically, from the rails stack, i only need AR (or an ORM).
The found solutions/approaches for t...
I like to use Textile or Markdown to write readme files for my projects, but when I generate the RDoc the readme file gets interpreted as RDoc and looks really horrible. Is there a way to make RDoc run the file through RedCloth or BlueCloth instead of its own formatter? Can it be configured to autodetect the formatting from the file suff...
accessing methods and properties from ruby win32ole gem seems easy, but what do I do when I have to set an enum more specifically, i am trying to set one of the values defined by warningLevelOption defined for VCProjectEngine but nothing seems to work. none of the objects accessible via win32ole , will not recognize this enum, and ...
I am currently trying to automate the deployment process of our rails app as much as possible, so that a clean build on the CI server can trigger an automated deployment on a test server.
But I have run into a bit of a snag with the following scenario:
I have added the friendly_id gem to the application. There's a migration that creates...
I have Mac OS X 10.6.2 with default Ruby 1.8.7. I installed Ruby 1.8.6 thourgh RVM (rvm install 1.8.6). While I run my tests with Ruby 1.8.6 I get error:
dyld: NSLinkModule() error
dyld: Symbol not found: _DestroyConstitute
Referenced from: /Users/snowak/.rvm/gems/ruby-1.8.6-p383/gems/rmagick-2.12.2/lib/RMagick2.bundle
Expected in: ...
I have a configuration file to which I want to add a string, that looks e.g. like that:
line1
line2
line3
line4
The new string should not be appended but written somewhere into the middle of the file. Therefore I am looking for a specific position (or string) in the file and when it has been found, I insert my new string:
file = File...
I'm trying to run some third party bash scripts from within my ruby program. Before I can run them though they require me to source a file. On the command line it all works fine but within ruby it doesn't work. Ive found out that system commands will open a new child shell process and any sourcing will be done in that and cant be seen fr...
I'm having problems getting thin working on my Windows 7 machine (I've already installed eventmachine v0.8.1):
>gem install thin --ignore-dependencies
checking for main() in -lc... no
creating Makefile
make
'make' is not recognized as an internal or external command, operable program or batch file.
Are there not meant to...
I am developing a complex form that updates several records of one model at once, whilst simultaneously updating an associated model. It looks a bit like this:
class Sport
has_one :photo
end
class Photo
belongs_to :sport
acts_as_fleximage
end
class Page
# the page is not related to either of the previous models
end
Just for ...
hi,
i have a code that works fine with ruby 1.87 but dont works with ruby 1.9. It says that CSV::Writer is undeclared but it still part of the rdoc. Does the csv api changed, after the fastercsv merge, or not?
my code:
require 'csv'
def self.export_csv
file_name = File.join(RAILS_ROOT, 'public','csv',"#{start_date_f}_#{end_date_f}.c...
When I use return the time that the record created, it show this :
2010-01-20 15:04:40 UTC
but I want the time in my specify time zone, for example, China. Is there any convenient method in RoR?
...
I have a template I use when creating a ruby script.
Currently when I rename a copy of that template and load it in emacs and get to coding.
I think emacs can load a template for me though. Ideally I could do this.
Ctrl X Ctrl F to open a file.
Type in name of file that doesn't exist (aka my new file).
Emacs recognizes the file does...
I want which order have different order status, so I have a table called "status", in the status.rb, it likes this:
class Status < ActiveRecord::Base
belongs_to :order
attr_accessible :name
end
And this is my order.rb:
class Order < ActiveRecord::Base
has_one :statuses
end
In my view, I try to call the related status like t...
Dummy question here. I'm developing an app that fetches location-aware info. I'm getting location coordinates in following manner: lat=+aaa.bb.cc.dd&lon=+aaa.bb.cc.dd&datum=wgs84
How do I convert those coordinates into standard latitude longitude with single dot. Now it looks as if client is requesting an ip address lookup.
...
I have followed Ryan Bates tutorial on nested models. Several of my nested models have dates associated with them. In my migrations, they are actually the type "Date."
Some things I have tried and problems I've run into
date_select - can handle the form object prefix, but not nested models attributes
select_year - doesn't work wit...
I have gotten sorting working from my rails application using acts_as_solr for text fields, as seen below with Title.
I am having problems getting it to work for date.
My model has the following
class Article < ActiveRecord::Base
acts_as_solr :fields[:title, {:title_s=> :string}, {:created_at_d => :date}]
def title_s
self.title
en...
I have a clean install of Ubuntu 9.10. I want to install Ruby 1.8, RubyGems and Rails.
The install usually fails when trying to get or update RubyGems. Sorry for the lack of details, I have gotten stuck on a number of fronts.
What is the best, guaranteed to work, installation guide\blog post\tutorial for installing Ruby, RubyGems and Ra...
I have a ruby script. I want to know how long the system has been idle (i.e. no user interaction - the time screen saver activation is based upon).
I believe I can do this in ruby via win32api using user32.dll and GetLastInputInfo, but I can't figure out how... can anyone can help me?
.
...
Is there any programming libraries available that will parse an HTML document, execute JavaScript and then allow me to navigate the DOM? This needs to be performed server side, not client side. Any language will do, but Java, PHP, or Ruby are preferred.
...