Tagged Questions
Ruby on Rails is an open source full-stack web application framework written in Ruby. It follows the popular MVC framework model and is known for its "convention over configuration" approach to application development.
0
votes
0answers
2 views
Custom devise update form not saving changes
I have a custom Devise form that I want to update my devise user with. But the from is not saving the changes.
Form:
.small-12.columns
.well
...
0
votes
0answers
4 views
Right to Left support for bootstrap-sass
I've downloaded bootstrap-rtl from https://github.com/morteza/bootstrap-rtl in order to add Right to Left support for bootstrap. I put the bootstrap-rtl.css file in app/assets/stylesheets directory, ...
0
votes
0answers
6 views
Rails: Using application helper in index.atom.builder
How do I use an application helper in an index.atom.builder view file?
Trying to use it throws an "undefined method 'xmlschema'" for "test123":String
2
votes
0answers
9 views
rhc setup - command not found
I am working on a MacBook Air, OS X 10.10 (Yosemite)
After successfully installing
Ruby 4.1.6 and
Git 1.9.3 (Apple Git-50)
OpenShift client tools rhc-1.30.2.gem
I got this message:
If this ...
0
votes
1answer
5 views
Pass Form Vars in Rspec to Update Method
I'm still fairly new to the rspec way. I've read many posts on a redirect_to but cannot seem to get passed this error. I'm trying to simulate the passing of form variable/value in my rspec test, but ...
0
votes
1answer
7 views
Ruby do block messes with bootstrap markup
This is probably pretty simple but I'm having issues with my erb in ruby interfering with my bootstrap layout. I'm using a partial to render a simple comment form and depending on where I start/end my ...
0
votes
1answer
14 views
Ruby - Iterate over parsed json with no hash name
So I'm trying to do some work with JIRA's REST API to get our upcoming releases schedule. From their API I can get returned JSON as seen below:
[{
"self": ...
0
votes
1answer
6 views
Customize generator templates in Rails 2
I'm adding new models to an old Rails 2 application, and I'd like to customize the scaffold templates. In the Rails guide, it says this:
In Rails 3.0 and above, generators don’t just look in the ...
1
vote
0answers
11 views
Rails 4 search over several models in separate controller
I'm trying to implement a complex search over a model in a separate controller. I have a pupils model. The whole app has a front page handled by a separate main_controller which has no model. The ...
0
votes
0answers
15 views
Elasticsearch versus PGsearch versus simple sql like
I am having a Ruby on Rails application which has its search implemented using elastic search. It is using Postgresql as database. There are two tables ticket and ticket_message. One ticket has_many ...
0
votes
1answer
10 views
Embedding a random date generator into an embedded ruby file
I would like to add this random date generator into my erb file...
def time_rand from = 0.0, to = Time.now
Time.at(from + rand * (to.to_f - from.to_f))
end
I apologise if this may seem simple but ...
0
votes
0answers
4 views
rails HABTM looks for relation in external objects database
I am seeing an issue where I am grabbing a person's record from an external database and checking it agains the local database for the roles they are assigned to.
Right now now I am getting a MYSQL ...
0
votes
0answers
16 views
JS in js.erb files is not executing, but Ruby code is
I have an update.js.erb file that gets rendered when my update action responds to js. However, none of the js I place inside of is executed (including when I try it with a simple alert), however my ...
0
votes
0answers
29 views
How to show multiple options selected in Rails
I got this model:
class Book < ActiveRecord::Base
mount_uploader :image, ImageUploader
belongs_to :editor
belongs_to :catalog
has_many :catalogs
end
_form.html.erb:
<div ...
0
votes
0answers
5 views
Authenticating a S3 resource using aws-sdk or plain ruby using canonical headers
Ref: http://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-header-based-auth.html
We don't want to use pre-signed urls (with expiresin param) as we don't want the end user urls to be easily shareable. ...
0
votes
1answer
7 views
Devise with omniauth redirecting to root url and I can't change it
when I log in or sign up with facebook, i'm being redirected to my root url.
In my omniauthcallbacks controller this is where I think it's happening:
def facebook
@user = ...
0
votes
0answers
16 views
Cannot persist embedded document Game without a parent document
I'm using Rails 4 and mongoid to build out my data models. But for some reason, when I try to create some seed data, it keeps giving me this error:
Mongoid::Errors::NoParent:
Problem:
Cannot ...
0
votes
0answers
21 views
Can't bundle sass-rails (4.0.3) ruby gem
When I try to bundle install or update, it gives me this error:
> bundle install
DL is deprecated, please use Fiddle
Fetching gem metadata from https://rubygems.org/..........
Resolving ...
-2
votes
1answer
30 views
Rails - decimal not displaying in view
I have the following object -
Reckoner Load (0.2ms) SELECT "reckoners".* FROM "reckoners" WHERE
"reckoners"."id" = ? LIMIT 1 [["id", 2]]
=> #<Reckoner id: 2, group: "test FTEProrated", ...
0
votes
1answer
17 views
Getting very long, cryptic error output from RVM
I'm doing a fresh installation of RVM on my Macbook Air after having done what I thought was a complete uninstall from my system. Now, however, when I try to run "rvm get update", I receive the ...
1
vote
0answers
25 views
ActiveRecord relation one to one with belongs to rails
Consider the following case. I want to restrict users to have at most one address, so my goal is to have at most one foreign key user_id in the address table set.
User has one address, which reflects ...
1
vote
2answers
22 views
Render form partial from view ROR
Im trying to render a form from another controller in my view.
This is posts_index, and the render post.comments works fine, but the form for a new comment doesnt.
<% @posts.each do |post| %>
...
0
votes
1answer
30 views
How to select unique values from a single column, with a default scope, returning multiple columns
In a rails application I need to return an ActiveRecord collection containing multiple columns, but only 1 column must be unique. There is a default scope which is not the unique value.
Default ...
0
votes
0answers
30 views
How to deploy latest Ruby on Rails on GoDaddy's VPS?
I recently bought a VPS from GoDaddy to deploy a website which will use Ruby on Rails because the shared server doesn't support rails.
After installing rails using cpanel I see that Rails 2.3.18 is ...
0
votes
1answer
9 views
File uploading to /tmp, rails 2
I want to upload an file to /tmp folder, then use it in controller. But a file do not goes from view to controller.
Look my view:
<% form_tag import_cash_payments_forms_path, {:method => :post, ...
0
votes
0answers
26 views
Rails - Duplicating models with associations
I am trying to duplicate a model and its associated records like this:
tmp = self.dup
self.revisions.each do |r|
tmp.revisions << r.dup
end
tmp.save
which doesn't seem to work as expected. ...
0
votes
0answers
4 views
Possible with carrierwave in Rails to upload photo to S3 based off of remote url?
In a Rails application that has a Resource with a photo object as a property through carrierwave which uploads to S3, I want to be able to create an object through ActiveRecord like
object = ...
0
votes
0answers
14 views
Magnific popup “The image could not be loaded”
I want to make what does when you click on a link, showing a modal window with the generated link to the google maps.
There is my .html
<div class="map-google-link">
<%= link_to "show ...
0
votes
0answers
7 views
RAILS twitter REST api upload image
Hy, thanks for your help me,
i have an question:
i want upload an image + tweet from my app rails,
now i use this for tweet a message + image:
consumer = Twitter.connect
u_token = @aut_tw.token
...
0
votes
1answer
6 views
Rails Monologue Filter Tags Button
Hi I am trying to create a button that filters monologue blog posts. I know that you can create links of tags that then filters the blog and just shows blog posts with the following tag.
This is my ...
0
votes
1answer
15 views
Ruby on Rails RubyMine debugger issues
I try to set up Rails Application in ruby 2.1.3 with RubyMine, however when it tries to install debugger it fails. I've tried a lot of different options, however haven't find any good solution. Pry ...
0
votes
0answers
14 views
Capybara JS tests running on separate thread?
I can't seen to get my Capybara tests to work when I put js: true. I think it has something to do with how I'm handling the DB in test. Any help here would be awesome. Here's my error:
Failure/Error: ...
0
votes
0answers
9 views
sidekiq retries exhausted with arguments
I crawl leads from other sites and activate them at mine. With Sidekiq I run a HealthCheckerWorker every hour to deactivate the lead on my site unless it's still up and running on the other site.
...
1
vote
3answers
48 views
Check if a date is between two other dates
I have a Model called "Tenant" and it has two Date attributes tenant_from and tenant_until.
I want to write a method that checks if Date.today is between the two dates I mentioned above. I want to do ...
0
votes
1answer
9 views
Exclude nil values from ElasticSearch Aggregation
I was using this query to retrieve the most significant values:
keywords = Answer.search(
:size => 5,
:query => {
:match => {
:question_id => 32481
...
0
votes
0answers
21 views
Execute arbitrary rails 4 controller action, render to string
In Rails 4, how does one execute an arbitrary controller action and render the response to a string?
This is obviously a bad practice, but there are circumstances when it becomes very difficult to ...
0
votes
0answers
18 views
How to set database table name in Rails 4 with dot in name
I have table with dot in name and cannot make query to it. My table name is: site.com_news
In model, according to How do I explicitly specify a Model's table-name mapping in Rails? i set:
class ...
0
votes
1answer
9 views
Paperclip :url does not create Routes
What is the point of using the :url option with paperclip? The :path option does in fact change the location where the file is saved, but the :url option doesn't seem to do a thing. It only works when ...
0
votes
1answer
20 views
RESTful API and rails
Not entirely sure if this is a beginner question, but I can't seem to find any detail information regarding how to use APIs with rails.
For the past months I've been to a few hackathons / interviews ...
0
votes
1answer
18 views
RSpec 3.1 undefined method `feature' for main:Object
I´m going through the rather painful upgrade to RSpec 3.1. I have several feature specs which worked in RSpec 2.99 that raise:
undefined method `feature' for main:Object
I noticed that I have to ...
3
votes
3answers
41 views
ruby add values to string separated by comma except the first element
device_target = ["3001", "3002", "3003"]
devices = ",kv1101="
device_target.map {|d|
case d
when "30000" #desktop
devices << ":9"
when "30001" # ...
0
votes
2answers
18 views
Devise gem User Authentication Ruby on Rails
This is my code for my index.html.erb scaffold
as you can see the if else stops a user to "show, edit or destroy" the
entries. However, they can create a new Rota entry by clicking New
Rotum. I can ...
0
votes
2answers
37 views
Bootstrap 3: Icons are not showing
I am using bootstrap 3 for my rails application. In view page the bootstrap icons were not showing.
My folder structures looks like.
app/assets/stylesheets/bootstrap.min.css
app/assets/fonts/ ...
0
votes
0answers
10 views
ActiveAdmin Access filtered collection
I'm trying to create a collection_action where I'm going to do something with the entire collection of filtered items. My problem is that from within the collection_action I don't seem to have access ...
0
votes
1answer
42 views
Make a number increment
I have this static code:
%a#carousel-selector-0.thumbnail
%img{:src => "http://placehold.it/170x100&text=one"}/
%li.span2
...
0
votes
1answer
10 views
bundle install gives error could not find email_spec-1.0.0 in any of the sources
I am new to RoR. I have got to open a project that is already created. The folder did not contain bin folder, I copied the contents of bin folder from some other project (which runs and which I have ...
0
votes
2answers
11 views
HAML with forms
I have this form:
= simple_form_for :login, url: sessions_path, method: :post, role: "form", class: "form-horizontal" do |f|
= f.input :email
= f.input :password
= f.input :remember_me, as: ...
0
votes
3answers
25 views
Ruby on Rails process data after session was finished.
I need to process large files uploaded by user. Process takes around 5 hours. What is the best way to process data after user finished a session and log out so it does not need to stay connected to ...
0
votes
0answers
17 views
saving in public directory when generating from string returns missing template
def download
html = render_to_string("offer_template_one", :formats => [:html], :layout => "templates.html")
pdf = WickedPdf.new.pdf_from_string(html,
:margin => {:top => ...
0
votes
0answers
6 views
Resque process jobs in batches
Currently one of the queues in resque(observer_queue) is meant to receive heavy traffic.
I have multiple jobs those get queued to this particular queue.
class Track::LogView
@queue = ...