0
votes
2answers
12 views
Rails not recognizing relationships
Having issues trying to set up the relationship in my database.
I have a user and some comments (1:N)
Class User ..
...
has_many :comments
end
Class Comment ..
..
belongs_to :user
end
...
0
votes
0answers
13 views
Runtime Error after rake test executes
This guy pops up after every rake test.
What am I missing?
rake test (normal output) then I get this: Errors running test:functionals!
#<RuntimeError: Command failed with status (1): [ruby ...
0
votes
3answers
17 views
link_to image_tag with options (rel, title)
In HTML I would write
<div class="imageRow">
<div class="single">
<a href="image.jpg" rel="lightbox" title="my caption">
<img alt="" ...
0
votes
2answers
23 views
Ruby: How to store large arrays in code
I have a controller in my rails app. It's a vulnerability scanner in which the signatures are read using nokogiri from an xml file every time the code is executed. This is clearly not the best way to ...
0
votes
1answer
27 views
Ruby - can't convert String into Integer
I have a JSONString in key value pair format and in my test I am trying to verify the value for a particular key in the string using:
JSONString['key'] should eq 'value'
My value is a string like a ...
0
votes
1answer
29 views
Calculate user reputation on creation of vote
I have a question and answer app that is similar in the way stackoverflow works. The vote model is polymorphic and belongs to 3 other models. A vote is created via a member POST route on each model ...
0
votes
1answer
14 views
How do i get value from td tag using nokogiri
Hi I have to inner value of price as give below
<td align="center">Avg.Rate: $ 555</td>
How can do this I am using nokogiri for this I tried this as
price_list('td[text()*="Avg.Rate: ...
0
votes
0answers
17 views
SSL connection error in production mode rails 3.2.3 thin server
I have
config.force_ssl = true
in my environment/production.rb file so as to make every request sequre with ssl and https.
I came to know that SSL can't be enabled in development mode. So, I ...
0
votes
0answers
10 views
synchronization database rails application
In the case of process automation synchronization database, I want to design and develop an application migration management databases of different engines. In a first time, I want to focus on three ...
0
votes
1answer
15 views
Nokogiri+Paperclip = XML parse with img from url
I need to parse some params to my DB and image from URL.
I use paperclip for image.
In Rails console I can add image to new post by this code:
image = Image.new
image.image_from_url ...
0
votes
1answer
14 views
Deployment is failing on update_code phase with rvm-capistrano
My working deployment script is failing with upload via sftp failed on XX.XXX.XXX.XXX: Net::SFTP::StatusException (Net::SFTP::StatusException write /tmp/20130610114941.tar.gz (4, "failure")) error.
...
0
votes
0answers
18 views
How to catch parallel session? (Ruby on Rails app)
I have read that parallel session is when at the same time a user can be logged in into the web application multiple times. I have Ruby on Rails application and I don't know how to catch the parallel ...
0
votes
1answer
19 views
Ruby - no PID found in tmp/pids/thin.pid (Thin::PidFileNotFound)
I'm trying to start thin for my app but then the pid cannot be generated:
$ thin -C /var/www/project_path/current/config/myproject.testing.yml start
Now I can't stop it because there is no pid:
$ ...
0
votes
1answer
38 views
File class private method open in production
Given the following method:
def import_photos
require 'fileutils'
File.open(Rails.root.join('tmp', 'fotos.zip'), "wb") do |f|
f.write(params[:zipfile].read)
end
...
0
votes
1answer
20 views
Carrierwave error: can't convert nil into String
I cant get carrierwave to work with Amazon S3. Get a can't convert nil into String error.
I am using couchrest_model, carrierwave 0.5.8, fog 1.9.0 and Rails 3.1.11
Cant upgrade to a later ...
0
votes
1answer
14 views
Post to facebook using Graph API and ruby
I'm playing with facebook Graph API and wanted to post to my timeline using ruby.
While posting using only URL I used
...
0
votes
0answers
14 views
Alternative to ActiveResource for XML?
ActiveResource fail to perform a simple find by id over XML so have to use:
self.all.select{|a|a.id.to_s == id.to_s}.first
Searching for a replacement found Her, but ORM is only for JSON and not ...
1
vote
0answers
22 views
Active Record :includes with limit and order by foreign key
Post.includes(:comments).order('timestamp DESC'.limit(5).to_a.size
returns 5 and produces this SQL code:
SELECT "posts".* FROM "posts" ORDER BY "posts"."timestamp" LIMIT 5
SELECT "comments".* FROM ...
0
votes
1answer
41 views
In ruby on rails how to get data from client side(android)
Android as a client side,i am sending data from client side to server side.Ruby on rails as server side,how to fetch data from client side using the post method.
I want to get the data from client ...
0
votes
0answers
35 views
Rails source code, what does 'autoload' do?
I am quite new to ruby. I am reading rails' source code to hence my understanding of the language.
In the source code, there are lots of module extend ActiveSupport::Autoload module and use the ...
0
votes
0answers
8 views
Tire Gem with Ransack for elasticsearch
I've been using Ransack with my MySQL data to produce an advanced form, I've switched over to elasticsearch recently and now I'm finding that even a simple form doesn't work (using the activerecord ...
0
votes
1answer
39 views
What should I include in Git project?
My webapp is written in Ruby on Rails. I'm new to git and want to know what kind of files should I include in the project. Please mention what files should I push into git projects.
1
vote
2answers
20 views
why has_and_belongs_to_many adds class methods rather than instance methods?
I have a couple of models
class Product < ActiveRecord::Base
has_and_belongs_to_many :categories
end
and
class Category < ActiveRecord::Base
has_and_belongs_to_many :products
end
Now ...
0
votes
1answer
22 views
Heroku Rails 4 / Ruby 2.0.0 Deploy Fail, Production Database is not connectable
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
could not connect to server: Connection refused
Is the server running on host ...
0
votes
1answer
20 views
Setting up a hour tracker in rails [closed]
I have an application based on the Devise cancan repo.
I have become fairly familiar with how to program in ruby and rails but the structure and layout of the application is a bit confusing for me.
...
0
votes
1answer
24 views
Ruby on Rails loop returning phantom objects in iteration
My Ruby on Rails app returns 'phantom' objects when iterating through my loop. The issue here is I have a SQL command in my Controller file that sets my locations array like so:
@locations = ...
0
votes
2answers
47 views
How to download a CSV file in Ruby on Rails?
In my InvoicesController I have this:
def index
@invoices = current_user.invoices
respond_to do |format|
format.html
format.xls
format.csv # not working!
end
end
In my ...
0
votes
0answers
31 views
libxml2 missing for nokogiri gem on Windows 8 x64 with Ruby 1.9.3
What I found searching for similar issues was that Nokogiri does not yet have x64 support with Ruby 2.0. However although I'm on a Windows x64 machine my Ruby version is ruby 1.9.3p392 (2013-02-22) ...
0
votes
1answer
13 views
Link_to helper method to include icon within a element [closed]
Here's what the default scaffolding generates:
<%= link_to 'Delete', admin_user, method: :delete, data: { confirm: 'Are you sure you want to delete?' } %>
I want to create a helper method so ...
2
votes
1answer
11 views
check existence of record on user in an associated model
I have a user that has_many associations. Associations has a provider field. I want to check if a user has a provider. If provider were a field on the user table I would just do provider.blank? How do ...