If in a database (MySQL), I have a datetime column (ex. 1899-12-30 19:00:00), how do I sum 1 day to it?
Following http://corelib.rubyonrails.org/classes/Time.html#M000240
If I want to add 1 day, it actually adds 60*60*24 days (86,400 days)
r=Record.find(:first)
=>Sat, 30 Dec 1899 19:00:00 -0600
r.date + (60*60*24)
=>Fri, 20 Jul 2136 1...
I have a simple has_many/belongs_to relationship between Report and Chart. The issue I'm having is that my Chart model is a parent that has children.
So in my Report model I have
class Report < ActiveRecord::Base
has_many :charts
end
And my Chart model is a parent, where Pie, Line, Bar all inherit from Chart. I'm not sure where the...
Sorry for the semi-generic title, but I'm still pretty new at rails and couldn't think of a succinct way to put the question.
I have a basic habtm model setup: a Project has many Resources and a Resource can have many Projects. I have the database and models setup properly, and can do everything I need to via the console, but I'm having...
Hi, I'm a Rails newbie and want to do something but keep messing something up. I'd love some help.
I have a simple app that has three tables. Users, Robots, and Recipients. Robots belong_to users and Recipients belong_to robots.
On the robot show page, I want to be able to create recipients for that robot right within the robot show...
I'm using Ruby on rails 2.3.8 and acts_as_taggable_on plugin. This plugin generates three tables: tags(which has the id and name of each tag) and taggings(relates tag_ids which the items that are tagged).
Now, I'd like to get all the items tagged with a certain tag_id. So, I go to my Announcement model(the announcements are the tagged i...
For every Card, I would like to attach a special number to them that increments by one.
I assume I can do this all in the controller.
def create
@card = Card.new(params[:card])
@card.SpecNum = @card.SpecNum ++
...
end
Or. I can be blatantly retarded. And maybe the best bet is to add an auto-incremement table to mysql. The problem i...
Ok here's my problem in a nutshell I've built a web service from ruby on rails. I'm using restful_authentication to create and run the login but I'm also building an iPhone application to access my web service but I can't quite figure it out. I was wondering if anyone could help me figure out a place to begin.
...
Hello,
Hoping to get some feedback from someone more experienced here. I haven't dealt with the dreaded floating-point calculation before...
Is my understanding correct that with Ruby BigDecimal types (even with varying precision and scale lengths) should calculate accurately or should I anticipate floating point shenanigans?
All my va...
I decided to use Amazon S3 for document storage for an app I am creating. One issue I run into is while I need to upload the files to S3, I need to create a document object in my app so my users can perform CRUD actions.
One solution is to allow for a double upload. A user uploads a document to the server my Rails app lives on. I val...
I asked this question earlier and got part of the way to where I needed to be.
I have a simple app that has three tables. Users, Robots, and Recipients. Robots belong_to users and Recipients belong_to robots.
On the robot show page, I want to be able to create recipients for that robot right within the robot show page.
I have the fo...
I am trying to use rackspace ssl smtp for my mail settings for our rails application and I am receiving this error
hostname was not match with the server certificate
I need to find a way to disable verify on the certs for ActionMailer.
Anyone know how to do this?
...
Hi Everyone?
I am trying to add a select box to the base of my create form that decides if an action runs from the controller...if that makes any sense?
Basically the application creates a project in FreeagentCentral whenever a new project is made:
def create
@company = Company.find(params[:kase][:company_id])
@kase = @company...
I'm looking for a way to pass fields into the factories of associated models without having to explicitly call the factory itself.
For example, lets say I have some factories like so:
Factory.define :person do |person|
person.name "Default Bob"
person.sex "M"
person.house {|p| p.association(:house)}
end
Factory.define :house ...
hi all
I have a ruby / rails application that integrates in and outgoing email directly into the app. The app is going to be running on multiple domains each with posible many users sending and recieving email.
I have looked into sendgrid, mailchimp and mad mimi as hosted services and also looked to create my own email server.
There ...
I'm developing a real estate web catalogue and want to geocode every ad using geokit gem.
My question is what would be the best database layout from the performance point if i want to make search by country, city of the selected country, administrative area or nearest metro station of the selected city. Available countries, cities, admin...
For whatever reason, my cucumber is using my _development db instead of my _test db.
How do I change that?
This is what my database.yml says
test: &test
adapter: mysql
encoding: utf8
database: myapp_test
but i get the error database configuration does not specify adapter
This is also at the bottom.... I can only assume that t...
Hi there,
Is there a way to have something like this:
File.new('http://hostname/myfile.zip')
inside a controller?
Thanks in advance
...
I have two models Store (with lat, lng columns) and Coupon.
Store has many coupons, as => couponables
Coupon belongs to couponable, :polymorphic => true (it's necessary for
coupons association to be polymorphic for other use cases).
Is it possible to do geo queries for coupons around a zipcode through
the Store model by declaring the ...
I need to generate links in my views using the url helpers such as user_path(@user), the catch is, in some cases I don't know what model I am creating this link for i.e. whether it is a user or a store or someting else
I would like to be able to determine this on the fly and call the appropriate view helper, currently I am doing the fol...
i've installed mySQL .. i entered my password , but i can't remember they've asked me for a username .. is it admin or root ?
i wanna add the username and password to RubyonRails database.yml
i remember i found a command that tells me the username and password in the mysql console .. but can't find it again !
that's the part i wanna ...