Tagged Questions
0
votes
2answers
44 views
how to insert hash into mysql using ruby
Let's say I have a hash:
{"MemberId"=>"MID-0000001", "MemberName"=>"Bruce", "OrderNumber"=>"ON-000000001"}
How can I insert this hash into orders tables of the db database in mysql?
...
1
vote
3answers
156 views
Building Ruby on Rails App with an existing Mysql db
I have a Mysql database with a large amount of data and tables. But i need to know how to use this Mysql data in the my new rails application. I've been learning Rails from a little time now. i know ...
1
vote
1answer
56 views
how to use Tire for getting data from Elasticsearch index and without hitting database
I am using Tire for implementing Elasticsearch. My environment is Linux,Rails 3.2 with Ruby 1.9.3.
I am able to index using Elasticsearch with the help of gem Tire(0.5.8).
But now to improve ...
0
votes
0answers
30 views
Saving and retrieving sales data from MySQL [closed]
How can I save sales data in a MySQL database for a particular date range?
For example, between 01-06-2012 and 30-06-2012 I add 120 (4 articles sold each day) after that I add between 10-06-2012 and ...
1
vote
5answers
1k views
Rails mysql2 undefined method `accept' for nil:NilClass
I know that was a milion times here but tried everything and I am still getting this error:
MacBook-Pro-kopankom:tripwall kopankom$ rake db:migrate
rake aborted!
undefined method `accept' for ...
0
votes
2answers
28 views
get a list of cities from location model and how many locations exist for each city
I have a location model which has a few columns: title, address, city, state, etc...
I am trying to show a list of all the cities based on the locations in my database. Then, I am trying to figure ...
0
votes
0answers
28 views
Timestamp Issue while storing any comment, System stores server time
In my rails project, I have to store some comments with respect to some specific note. Right now client have its own windows based production machine, where application is deployed.
Now I am testing ...
0
votes
3answers
23 views
Able to add myself as friend in rails console
I have built a user and friend relationship model but the problem is that with those associations I can friend myself. I have successfully suppressed it in my views and controller, but logically it ...
0
votes
1answer
21 views
How to group by day and year in Active Record in Rails3
I'm trying to recreate the following mysql query in rails 3
select count(id), year(created_at), month(created_at) from table where published_state = 'published' group by year(created_at), ...
0
votes
2answers
25 views
How to use user defined variable of ruby in mysql?
I'm working on Rails 3.2.9 app with ruby 1.9.3 and mysql 5.5. I'm required to write a query where in i'm supposed to use a user defined variable in the where clause in my controller file. Here's the ...
0
votes
0answers
13 views
rails insert run mysql specific commands
I have a rails app where I need to run AES_ENCRYPT on a particular field, when I create a new row. Is it possible to do something like self.field = "AES_ENCRYPT(#{self.field}, #{key})"?
Also, I need ...
0
votes
1answer
30 views
If I Fork a process in ruby, do I need to reconnect to Mysql DB?
I'm using the following environment.
Rails 3.1
Unicorn
Mysql
I have to fork a process wich generate invoces. People told me to use
ActiveRecord::Base.connection.reconnect!
Because with some ...
4
votes
2answers
53 views
Fetch records where all associated records have attribute
Here are my classes:
class Product < ActiveRecord::Base
has_and_belongs_to_many :categories
end
class Category < ActiveRecord::Base
has_and_belongs_to_many :products
end
Category has a ...
0
votes
2answers
43 views
Rails query interface where clause issue?
i am try to run the sql query as follows
@applicants = Applicant.where("applicants.first_name LIKE ? AND applicants.status = ?", "%#{people}%", ["new", "in-review"] )
I am getting an mysql error ...
0
votes
1answer
33 views
nonexistent mysql adapter during bundle exec rake asset:precompile
I'm trying to precompile my assets on the production server using bundle exec rake asset:precompile. When is run the rake, I get the error below. What is causing this?
[x]$ bundle exec rake ...