Tagged Questions
0
votes
0answers
6 views
How to keep a websocket client open in rails
I have a Rails 3.2 website which uses http. But the rails server needs to connect to an other server using websockets and my rails app is the client. How do I keep the client websocket open in rails ...
0
votes
1answer
13 views
show records from two different models using pagination
i have two models ..video and youtube_video....i have a index page to show both videos..so i am adding both resultset in one array to show on index page but i am getting pagination error..as undefined ...
0
votes
1answer
10 views
Handling Net::ReadTimeout error in HTTParty
I am using httparty (0.13.1) gem. I am making series of API calls using httparty. Some of my initial API calls succeeded, but the later calls fail consecutively. I have added a timeout of 180 seconds. ...
-1
votes
0answers
19 views
Date range for array [on hold]
Trying to loop an array and grab results within a certain date range. The query below is timing out.
Controller
@results['data'].each do |data|
result_data << ...
0
votes
0answers
11 views
Rails “self.primary_key = 'another_key'” isn't working
I have a Rails 3.2 app that uses a legacy database so most tables and ids aren't in the Rails format. The whole app uses set_table_name and set_primary_key, and as we've recently migrated to 3.2 from ...
0
votes
2answers
17 views
ArgumentError in UsersController#create; Wrong number of arguments (2 for 0)
I'm getting the error "wrong number of arguments (2 for 0) from 'build_profile' function in user.rb while trying to add a profile to a user using the one to one relationship.
Models
User.rb
class ...
0
votes
1answer
20 views
link_to not working and getting Page not found Only get and post requests are allowed
My route.rb:
------------
*resources :accounts, :path => "expos" do
resources :shows, :path => "events" do
resources :show_sessions, :path => "session"
end
end*
<% ...
1
vote
1answer
25 views
Rails + AngularJs + Unable to fetch data using Service
In my AngularJs app with Rails server as backend, I am trying to fetch data using GET method but unable to access the data. Not able to recognize the error.
AngularCode
var app = ...
0
votes
1answer
16 views
Search two models with Ransack Parameters
I have two models: Patient and Facility.
Creating a new patient I have a modal that opens and does a search on the number of patients. Then, I have 4 fields that the usr can fill in and search for a ...
0
votes
1answer
19 views
How to store each key or element from array to database in rails
I'm stuck on trying to store keys or elements from a returned array into the database. It looks something like:
{"id"=>"28898790358_10152709083080359",
"from"=>{"category"=>"Tv channel",
...
0
votes
1answer
26 views
Refinery CMS undefined method `validators_on'
I get a undefined method `validators_on' for NilClass:Class error when i try to use Refinery CMS.
the block of code is :
class ActionView::Helpers::FormBuilder
alias :orig_label :label
# add ...
0
votes
0answers
34 views
Can't insert multiple data has_many :through association join table
I have 2 table in database. One is projects(:id,:projectname) and users(:id,:username).I join those tables with has_many :through associationproject_users(:id,:project_id,:user_id). Now all 3 table ...
0
votes
0answers
19 views
ajax still working after removing remote-true in Rails 3.2.19 and ruby 2.0
i have been using ajax on many places on my website.NOW i decided to change few click from ajax to normal page load..but its not working.i know its as simple as removing remote="true" from link_to or ...
1
vote
1answer
24 views
have a boolean that must be set to 0 rather than false
I have an Item object that has a boolean value called has_instore_image that when set in a before_save method must be set to 0 rather than false. Is there a reason why this is so? Is this the expected ...
0
votes
1answer
11 views
Add method to a gem's helpers
I am using a gem which adds a number of View helpers under the following module heirarchy:
module Ransack
module Helpers
module FormHelpers
def search_form_for
end
end
end
end
...
1
vote
1answer
63 views
Is there a way to do lazy loading in Rails 3.2?
I've built, maintain and continually improve a website for an insanely complex fantasy football league I'm in where GMs have $130 of salary cap a year, players all have a starting salary value and may ...
0
votes
2answers
20 views
Having some problems using Rails 3, keeps going to Rails 4
I'm relatively new to Ruby, and Rails, I need to use Rails version 3.2.19, for some tutorials I'm following along, I get all kinds of errors trying to follow along with Rails 4...anyways, when I do: ...
0
votes
1answer
24 views
simple onclick in js already added in application.js doesnt executes- rails 3.2.19 and ruby 2.0
i know this is very immature question to ask but recently i added a simple onclick method in my users.js file already added to application.js.Now as far as i know..all the js is available to me in a ...
0
votes
0answers
7 views
disable i18n some small view parts?
The specs are:
Rails 4.0.2
Globalize 4.0
I am building multiply language site with 3 languages (nl/en/de). The default language is NL.
I have this code in my haml view:
= ...
0
votes
0answers
11 views
assert_select not working after redirect
Can an assert_select work after an assert_redirected_to? I have the following controller action and I'm getting a failure.
test "get switchboard" do
...
assert_redirected_to employees_url # ...
0
votes
0answers
35 views
Importing every line from xlsx in seed file - rails
On my seed I import some data from xlsx files. It's working for small ones, but it doesn't work for a particular file... This file has around 1265 rows and I have to run "rake db:seed" command 3 or 4 ...
0
votes
0answers
39 views
dependency error while installing gem
My rails version is 3.2.13 and ruby version is 1.9.3
While installing activeadmin gem I am getting dependency error which says -
ERROR: While executing gem ... (Gem::DependencyError)
Unable to ...
-1
votes
0answers
16 views
How to handle Delay job(sidekiq) logs through email?
gem "sidekiq", "3.0.2"
gem "sidekiq-status"
Redis server
we are running some process through delay job
delay_job = User.delay(:retry => false).generate_csv(params)
sometime ...
0
votes
0answers
38 views
Error: “No such file or directory” when uploading image using carriewave
I am using Rails 4 and Ruby 2. I am trying to upload an image using carrierwave and getting an error "No such file or directory - XYZ.jpg". But when I keep the image inside my app folder it uploads ...
0
votes
1answer
13 views
Select certain Date data from json Rails
I'm trying to select only results from Date.today + 1.day from a parsed json series, but i have confused myself on how best to implement this.
json is formatted as:
{"status": "ok", "data": ...
0
votes
0answers
30 views
Tweetstream Daemon not working
There are many posts of people struggling to get Tweetstream working with Daemon, but none of the solutions I've found seem to work for me. I am using the standard code extract from Tweetstream.
I ...
0
votes
2answers
29 views
Bootstrap Nav Tabs and gmaps4rails
Having a slight issue with Bootstrap 2.3.2 Nav tabs and centring on my gmaps4rails marker. I have tried several solutions to no avail. At present the marker is just off to the top left hand side, just ...
1
vote
0answers
16 views
implementng Report this functionality in Rails application
i have a website built on rails 3.2.19 and ruby 2.0 where the user can post and share videos/images and songs.Now its quite likely that i need to protect my website from fake/spam uploads as many ...
0
votes
1answer
13 views
after_filter or Sidekiq for managing a page_view information
I have a Rails app and currently I create a PageView object for each API access. Our API is still pretty fast (50% of request are < 50ms) but most of the time is spent in writing the PageView to ...
0
votes
0answers
29 views
undefined method 'empty?' for nil:NilClass on every controller action
Every time I try to load any page on my local server, I get the following error:
Server error
[2460faa3017297069fc8b26865c3f95c] [127.0.0.1]
[2460faa3017297069fc8b26865c3f95c] [127.0.0.1]
...
1
vote
1answer
34 views
Has and belongs to many association search in thinking sphinix rails 3.2.14
I am using Rails 3.2.14, thinking-sphinx 3.1.1 and Sphinx 2.2.4-id64-release (r4806)
I have two modals below:-
Album.rb
has_and_belongs_to_many :genres
Genre.rb
has_and_belongs_to_many :albums
...
0
votes
1answer
23 views
Dynamically determining if a collection path exists
This might seem like an unusual case.
If I am dynamically given a "@model" variable, that can be any ActiveRecord model class, how can I check if that model has a corresponding "/models" route?
...
1
vote
1answer
38 views
force_ssl in production.rb - how to override in controller to just be http
in my production.rb, I have
config.force_ssl = true
and would like to provide exceptions. It looks like this should work (can't find how to get back to 3.2.19):
class ApiItemsController < ...
0
votes
0answers
14 views
Automated Warning message appended to the email in rails
I am testing the rails action mailer with my application to send emails to my mail Id. The mail is being delivered successfully to my inbox, but, the following Warning message is being automatically ...
1
vote
1answer
20 views
Sending arrays of arrays as parameter and then again looping though each array
i have a scenario where i am sending notification mail to all users.hence i need to get all info such as useremail,videocount,imagecount,videoids,imageids etc and send to usermailer to send mail.i ...
0
votes
1answer
20 views
rails 3.2 renders RAW Javascript when URL is having .js extension
I'm having weird issue. I'm getting RAW Javascript Code when URL is having .js in URL.
http://www.test.com/documents.js?list_type=index&page=2
Any idea, why it is behaving like this?
def index
...
0
votes
0answers
16 views
Update devise user information with nested form
I am trying to edit phone information within the devise "User" table.
When i wrote the code differently than what devise/registrations/edit.html.erb does it does says no such route "PUT" while in ...
0
votes
0answers
36 views
Rails route going to wrong controller action only when there is a rescue_from
I am trying to add a very simple API to an existing Rails 3.2 web app (using this guide). I am running into an issue where my route is executing an existing action instead of my new one but only if I ...
1
vote
1answer
53 views
Active Admin Nested models not populating in edit
So, I've been tinkering around with Active Admin, and so far even though the documentation is not great I've been sailing along. But I encountered an issue when I try to edit a model with a few ...
0
votes
2answers
25 views
Can't run “rake test” after dropping a table
In one of my recent migration files, I dropped a table I created a long time ago (drop_table :transactions)
Since then "rake test" fails with
ActiveRecord::StatementInvalid: PG::Error: ERROR: ...
0
votes
0answers
29 views
Left join in rails
Controller
@user= EventPlayer.joins(:user=>[:home_country,:roles])
.merge(User.filter)
.select('SUM(money) ...
0
votes
0answers
18 views
Ruby on Rails new instance within different controller
I'm sure this is easy but I can't figure it out
I have basically two scaffolds: Envelope and Transaction.
I can go into the transaction views and make a new transaction like normal but what I want is ...
1
vote
2answers
31 views
flltering array depending upon the models or table names in rails 3.2
i have a resultset(array) returned from a solr search which contains different rows from different tables(models).NOW suppose my models are image,video(there are many more) etc and my resultset ...
0
votes
1answer
18 views
Rails 3 TestUnit file fixture Tempfile becomes String in controller
I have the following code to test file uploading:
test 'when a user adds an attachment to an existing candidate, the attachment shows up on the candidates page' do
user = login_user
opportunity = ...
-1
votes
1answer
25 views
Cannot find a valid mapping for user#id which is causing a runtime error?
i am trying to set reset password for my application by following the tutorial at Railscast Reset password tutorial and everything went well until the last step after clicking the reset password link ...
0
votes
1answer
19 views
Linux Apache Server Running Phusion Passenger and 2 Apps has 8 ruby processes?
I'm trying to resolve some memory issues on my Linux (Ubuntu) Apache server which runs Phusion Passenger and 2 Rails apps successfully.
Everytime I kill all the ruby processes or restart the server, ...
0
votes
0answers
31 views
Generate friendly Url for SearchKick rails
Using searchkick for my rails application, when try to search getting the path as,
example.com/?utf8=✓&query=vintage#
How can i make more readable like example.com/vintage, but it should ...
0
votes
1answer
61 views
How do I add/remove values to a collection_select (Drop-Down List) in Rails?
I am looking some some guidance on how to add and remove values to my drop down lists.
Here is my code I am using in my View/Project/_form.html.erb
<div class="control-group">
<%= ...
0
votes
0answers
26 views
Precompilation of Assets for multiple environments
I have a rails project with multiple environments. I'm using rails 3.2 on ruby 1.9.2-p318.
If I deploy the project to my server, I want to execute the rake task to precompile the assets.
After ...
0
votes
2answers
27 views
Rails: Error on form_tag custom action
About a year and a half ago I took an online course in Ruby on Rails using version 3.2. I got through the class and made the application and now I'm going back through the class PDFs and doing it in ...