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.

learn more… | top users | synonyms (2) | ruby on rails jobs

0
votes
1answer
13 views

undefined method `symbolize_keys!' for #<Array rails 4

In mcs_mailer.rb: def invite(email,subject,body,attachment_urls) @attachment_urls= attachment_urls mandrill_mail( template: 'group-invite', subject: subject, to: email, html: body, ...
0
votes
0answers
6 views

CanCan and ActiveRecord. How to limit file dowloads to a certain role

If I have an Admin and SuperAdmin role. How can I limit downloads to the SuperAdmin only. index download_links: current_user.super_admin? do column :email column :query default_actions ...
1
vote
1answer
9 views

validate attachment format for specific models in rails4

Hi I am having polymorphic association with attachment model with profile and document table. I have included following code in my attachment.rb class Attachment < ActiveRecord::Base belongs_to ...
2
votes
1answer
20 views

How to make params[:action] work if I pass parameters “action=test” in the end of url?

Below is my index action: def index @api = Api.find_by(name: params[:name]) @descriptions = @api.descriptions.all if valid_json?(@descriptions.first.value) render json: ...
0
votes
1answer
10 views

How to pass timezone name from JS to Rails?

I'm using JS to get the timezone name (i.e. Asia/Baku). Now I want to add records to the database, with the created_at column corresponding to the selected timezone for that record. How can I do this? ...
0
votes
0answers
3 views

Override Spree Commerce's Bootstrap Variables

I'm having an issue with deploying a customized _variables.scss to my production server as a compiled asset. Everything is fine on my development environment, it's in production that my variables are ...
0
votes
1answer
23 views

How to put values for 2d array using their index in ruby?

I'm new to Ruby. I'm trying to initialize a 2-dimensional array by accessing its index values. Whenver x < y (for ex dp[0][1]) then it should be 0 and if x==y then it should be 1 dp ...
0
votes
0answers
9 views

rails, Cannot run sidekiq

I have created sidekiq.yml file inside config folder: --- :concurrency: 25 :pidfile: ./tmp/pids/sidekiq.pid :logfile: ./log/sidekiq.log :queues: -default I have added foreman gem in my Rails ...
0
votes
0answers
10 views

how to implement full text search using elasticsearch in rails

I am following this article to implement full text search using elasticsearch in my rails application but I am getting this error /.rvm/gems/ruby-2.1.5/gems/rack-1.6.1/lib/rack/builder.rb:49: stack ...
1
vote
1answer
12 views

Using Rspec should_receive to test that a controller calls a method on an object correctly

OK first, I should say while I've read a lot about should_receive, I'm still not entirely sure I'm understanding the concept behind it, so what I'm doing could potentially be completely not possible. ...
1
vote
0answers
14 views

Initializing a new object for a form

I am just learning rails and hope someone can guide me on a theory question. The course assignment I am working on requires me to initialize a new comment object for a partial that includes a form ...
2
votes
0answers
9 views

configuring rails application to make ui router work

I am trying to implement ui-routing in my rails application but it is not able to find the page to which i want to route to. the tree structure in rails that i followed is app assets javascripts ...
-1
votes
1answer
12 views

nested resources rails has and belongs to many

Sorry for the generic title, but I'm not sure how to phrase it better at the moment. I finally had some time to start picking up rails again and came across this issue as I was building my models: ...
0
votes
1answer
18 views

Why are my unchecked f.check_boxes giving default value of “1” in rails?

I have a checkbox below. It's rendering properly (unchecked) but submitting with a value of "1". I want the unchecked boxes to have default values of 0. <%= builder.check_box :content, ...
0
votes
2answers
18 views

Passing parameters to ruby methods in Rails

I have method inside AplicationController which I want to be reusable from all controllers: class AplicationController < ActionController::Base ...
0
votes
0answers
9 views

WickedPDF not working in production server

I am using wicked_pdf gem, it works fine in local machine, but in server its not working. I have checked the process of wkhtmltopdf, It tries to run follwoing command /usr/local/bin/wkhtmltopdf -q ...
0
votes
1answer
21 views

Is it safe to update data in the database real time using AJAX?

In my app, for the shopping cart, I need to update the quantity values real time. Let's say someone set the quantity (but does not submit) and then close the browser. After a day or two he re-login ...
2
votes
0answers
20 views

Is it bad practice to name a model “Image” in Rails 4?

In my Rails 4 application I have a model named Image. Image is not a reserved word in Rails 4 as far as I can tell from the list of reserved words listed here: ...
0
votes
0answers
23 views

How to set id when liking a comment?

How can I get this comment_like_id: nil, not to be nil when a comment is liked? I toyed around with this line in comments/_comments: <%= link_to like_comment_path(:id => comment.id), class: ...
1
vote
2answers
18 views

routing error for an message/article

I been making a website and a followed a guide to make a message using rails. But, when I click 'Save', it comes up with an routing error: Routing Error No route matches [POST] "/articles/new" ...
0
votes
0answers
11 views

Trouble rendering custom css + bootstrap on heroku in certain browsers and devices

Not sure whats happening here, first time seeing this. Everything is working fine in development, but when pushed to heroku my css only works for large screens with firefox or chrome. Small devices ...
0
votes
0answers
10 views

How to reactivate a user's account with devise once deactivated?

I have successfully implemented the deactivate function for the user. So now my account is deactivated. I am using devise. Now I try to login again, I get the message : "Sorry, this account has been ...
1
vote
1answer
18 views

Ruby on Rails first steps

I have installed ROR+apache2 on my Linux VM (TurnKey Rails VM image) and making first steps folowing http://guides.rubyonrails.org/getting_started.html this guide i have stucked on adding resource ...
0
votes
0answers
6 views

I have a search bar in application.html.erb, where do I put the validation?

I have the same text field hooked up to a search and an upload button in my application.html.erb. I want a validation for when the upload is clicked that there is text present for params[:q]. I just ...
-3
votes
0answers
22 views

Coding Languages for eCommerce in 2015 [on hold]

I am fluent in Python and HTML/CSS as it stands today. If I were to get into the entire realm of eCommerce/CMS what languages are best practice in 2015, is PHP still leading the charge? I heard good ...
0
votes
1answer
5 views

Rails - HABTM find or create nested form

I found this. My question is now how do I create the form, I am trying: #students.row = f.fields_for :classrooms_students, f.object.classrooms_students do |cs| = ...
0
votes
0answers
3 views

Caching generated PDF with memcache

We have a Ruby on Rails application that generates dynamic pdfs. At the moment it generates PDF on every requests even it is not changed. Is it possible that we cans tore the PDF in memcache?
0
votes
1answer
19 views

Nested query in Rails without using find_by_sql

My sql query is SELECT MAX(sale_money) FROM ( SELECT SUM(sale_money) sale_money FROM sales WHERE MONTH(created_at) = 5 GROUP BY user_id ) t I write the subquery in Rails 4 code: ...
0
votes
0answers
8 views

How to fill in form quickly use active admin?

Hi my company is using active admin to create some dynamic pages. But whenever I want to update a page information, I have to click "edit page", then "update page". Then I have to refresh the browser ...
0
votes
0answers
5 views

Rails Payola: add a coupon to an existing subscription

We're working on a SaaS product that uses Payola to handle payment, and we'd like to add a referral promotion. Adding the coupon to the referee is simple enough (hidden field on the form with the ...
0
votes
1answer
21 views

How to access Guest's port 3000 from Host

Here's my Vagrantfile: # -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure(2) do |config| config.vm.box = "ubuntu-14.04-x64" # Sync'd folders config.vm.synced_folder ".", ...
0
votes
1answer
17 views

Getting all fields in form_tag without attribute name in Ruby on rails

I am new to Ruby on Rails. When page loads, it displays a form with text boxes having some value in it and at the same time allows the user to enter a new value in those text boxes. Below is my view ...
0
votes
0answers
10 views

PUT/PATCH with java.net.URL

How to update a record in Rails app with java.net.URL (client). i can't find any examples that using setRequestMethod("PUT") or ("PATCH"). my client side code is: void updateCardInServer(String ...
-2
votes
0answers
14 views

Javascript functions not working properly in Rails app

I am trying to marry a legacy web app to a rails 4 app (because I have to). The legacy code has a lot of onclick(), onload(), etc javascript functions in various tags throughout the pages. I cannot ...
0
votes
2answers
30 views

Can't update user in Ruby on Rails

I am using ruby on rails try to update user information, but when I submit, the console will show an error saying the user exists and redirect to the correct page. What's wrong with my code? The ...
0
votes
2answers
7 views

Rails 4 - How do I structure this model relationship?

In my app, I have two models, Task and Guideline. Each Task can have many Guidelines, and each Guideline can belong to many Tasks. How would I set up the relationship between these two models, if it ...
0
votes
0answers
6 views

Rails WiceGrid with multiples attributes in the same column

My project has 2 columns for the table user, "first_name"" and "last_name" and I want to show them in just 1 column and with 1 field to filter it (Full Name). I have something like that: g.column ...
0
votes
0answers
9 views

Editing multiple objects with simple_form

In the Railscast dealing with Editing Multiple, Ryan shows how to edit multiple objects in batch with form_tag. Is there a good way to do this using simple_form?
1
vote
0answers
14 views

How to read barcode png in barby rails?

I'm try gem barby for generate barcode png and works perfectly. Now I have problems reading my png barcode to make sure this barcode is valid. How can I read a barcode png in gem barby rails?
0
votes
0answers
7 views

Fix spurious rspec “photo can't be blank” failures for Carrierwave

I have a Rails 3 app that uses rspec for testing and Carrierwave for image uploads. Right now, we have a Profile model that has several image fields, for example: photo1 and photo2. My rspec tests ...
0
votes
0answers
5 views

Clockwork not logging to Heroku console

I am using the Clockwork gem to run a series of rake tasks. All looks good, but it seems the puts commands dont appear in the logs, and was just wondering if anyone had any idea why? require ...
1
vote
0answers
14 views

Checking a rails API request comes from JS assets

I want to call some API methods of my rails app using JS from within the same app's assets (using jquery/ajax) so that I can call controller methods from within my JS, but I don't want those API ...
-1
votes
0answers
10 views

3 model in 1 form_for rails 4

I wanna know how to make a form_for with fields from 3 models. the relation between the models are: modelOne: has_many: modelTwo modelTwo: belongs_to: modelOne has_many: modelThree modelThree: ...
0
votes
1answer
12 views

Backbone.Marionette + Rails app redirects after form submission. Why?

I have a sample app that I'm working on that uses Ruby on Rails for the server backend and Backbone.Marionette for the client-side. The main functionality is a form to "order a widget". I'm using ...
0
votes
1answer
15 views

How do I update create route from rails 3 to 4

I have a form tag which is seen below, when I try to run the page I get the error: No route matches {:action=>"create", :type=>"new", :controller=>"lists"} <%= form_for @list, :url => {:action ...
-1
votes
1answer
15 views

Can your controller methods route to different pages other than the default in Ruby on Rails

I'm working on a Rails application and I want a form to render with AJAX when I click on a button. I have the routes set up so that when I click the button, rails goes to the NEW method in the ...
-1
votes
0answers
4 views

How to grab file path from file field in form_for

So a couple days ago I realized that I got boned over by Heroku because it doesn't support file uploading. So after doing some research I decided to go with Cloudinary. It seams simple enough but in ...
2
votes
1answer
24 views

Building a simple calculator form in Rails 4

I am looking to build a simple set of calculators in a Rails 4 application and I am at a bit of a loss as to how I should go about setting up my models and controllers. In this example I have a ...
-1
votes
0answers
10 views

Ruby upon update error, render different contoroller and action

Code: class PlansController def update if @plan.update_attributes(edit_params) ... #success else flash[:danger] = "message" render controller: "staticpages", action: ...
0
votes
0answers
12 views

Why does pg_search prefix not work like I expect?

This is my pg_search method: pg_search_scope :node_search, against: [:name, :user_id, :circa, :cached_tagged_user_names, :cached_user_tag_list], using: { tsearch: { any_word: true, dictionary: ...