Ruby on Rails is an open-source web development framework written in Ruby. Ruby on Rails follows the principle of convention over configuration, freeing you from having to re-invent things to stay productive. Ruby on Rails 4.0 is the latest edge version available.

learn more… | top users | synonyms (2)

0
votes
2answers
14 views

Delete all in rails console

i have an association for a user as user has_many agents and agent belongs_to user. in rails console,i am trying to use different users to test a particular scenario and i want a user with no ...
0
votes
2answers
10 views

Rails routing: resources with only custom actions

I have a NotificationsController, in which I only have the action clear. I'd like to access this action by doing POST /notifications/clear So I wrote this in my router: resources :notifications, ...
0
votes
0answers
15 views

jquery mobile: javascript not firing after submit

im using jquery mobile + ruby on rails 3. after a submit and redirect back, the javascript is not really working. for example: datepicker is also not working: $(function() { ...
0
votes
1answer
15 views

rails 3 model associations model with rails_admin

Could some 1 help me please with associations in rails app. This is my models: class Catalog < ActiveRecord::Base attr_accessible :name has_many :parent_catalogs end class ParentCatalog ...
1
vote
1answer
20 views

Stripe undefined method `create' for #<Stripe::ListObject:

I'm trying to allow a user to add a credit card in my app using Stripe. When i call the code below (which is from the docs: https://stripe.com/docs/api#create_card), I get the error below. Are the ...
1
vote
1answer
19 views

Should I wrap this controller code in an ActiveRecord transaction?

I have a Create method in my API PeopleController that creates a Person, Company, Email Addresses and Phone Numbers. I have a feeling that I need to wrap all this code in a transaction, so that ...
0
votes
1answer
5 views

Rails: state_machine method for this or later states?

Is there any way to access that functionality within the state_machine gem? Kinda like levels: def check_if_editor redirect_to :root unless current_user.editor? OR ANY NEXT STATE end Can't find ...
0
votes
0answers
6 views

Rails Ajax Link Deleted the Wrong Model

I have a Rails 3.2.8 app running on ruby 1.9.3 with devise. In it, users have workouts. I was adding some functionality, when an error in the workouts#destroy method deleted a user. I have fixed the ...
0
votes
1answer
16 views

Rails self recursive issues with Parents and Children

I am rying to add a subsidiary to a company. SO I will go the company, and the select from a list 1 or more subsidiaries and save. So I am NOT saving a company to a subsidiary (as it seems its the ...
0
votes
0answers
5 views

Rails3 force_ssl for 3 specific views and go back to http for others

I have a Rails3 app and I have the following in one of my controllers: force_ssl :only => [ :action1, :action2, :action3 ] and its succesfully redirect those actions to https. When I redirect ...
0
votes
1answer
18 views

Trouble getting DelayedJob custom job to work

I've been trying to implement a DelayedJob custom job for a very long time, but am not finding much information online in terms of how to do this from start to finish, and am finding almost nothing ...
0
votes
0answers
22 views

install rails 3.2.3 gem but get 4.0.0

As shown below, I install the rails 3.2.3 gem but I seemingly get RoR 4.0.0. I might go ahead with 4.0.0 but I am trying to follow the Hartl Ruby on Rails tutorial which is written for Rails 3.2.3. ...
0
votes
0answers
6 views

Set a default value with find_or_create method in rails

I have an associated find_or_create. If the record does not exist...and is created...it needs to be saved with a user_id set to the current_user. The find_or_create method Im using lives in a model ...
0
votes
1answer
15 views

Rails model validation: How to make sure a attribute is in a list

Hi I have a job model which has an string attribute called category. In the front end, I have a form with a dropbox where a user can fill out the category attribute with the selected value from the ...
0
votes
0answers
6 views

getScript jQuery path not working / Ruby on Rails

I've got a jQuery function that is called after a doubleclick on a list item. app/assets/javascripts/tile/tile.js $('#list > li').dblclick(function(){ // styling ...
0
votes
0answers
14 views

google maps zoom to fit bounds to display all poly lines

In the following Coffeescript code get the tracksegments from database and display all of them on the map (poly lines shape). i want to fit to zoom on map for showing all of poly lines. but this code ...
0
votes
1answer
21 views

Rails No Method Error for Schedule

I seem to be having a separate problem from the other guy who posted something like this. The following comes when I just go to my homepage which should have a form... Any ideas on this sort of ...
0
votes
1answer
18 views

Will looking up parent document cause an extra query call?

I have two models. class User include Mongoid::Document field :name, type: String embeds_many :posts end class Post include Mongoid::Document field :comment, type: String embedded_in ...
0
votes
0answers
25 views

CarrierWave not processing images to correct dimensions

I am using the Streamio-FFMPEG gem to take screenshots from videos on AWS. The screenshot is saved to the video.screenshot column and ScreenShotUploader handles uploading the screenshot to AWS. ...
0
votes
0answers
5 views

Rails user can disable/enable nested form

Hello i would like to have a form with two nested forms. Example: Registration User (main form) Add Address (nested form) Add Company info (nested form) Now i have it working but i want that user ...
0
votes
1answer
13 views

Rails turn form to bootstrap form

At the time i have defined two search forms in my app: How you can see the second form doesnt look so nice and disturbs my layout. So my aim is to style the working form (second form) like the first ...
0
votes
4answers
30 views

How to create a model with a certain id using rspec and factory girl

I use: gem 'rails', '3.2.11' gem 'rspec-rails', '2.13.2' gem 'webrat', '0.7.3' gem 'factory_girl_rails', '4.1.0' gem 'spork', '~> 0.9.0.rc' I want to test my HP where I always have a link to a ...
0
votes
2answers
29 views

Adding/Updating column in a Model using RubyMine

I'm working on a web app that basically interacts with a db table through a form. Recently I had to make some changes which resulted in me adding another column to the db table. I'm using RubyMine ...
0
votes
1answer
17 views

Unable to receive recipient view url of docusign

I am using docusign_rest gem. I am creating template with create_template method and envelope with create_envelope_from_template method. But when I was trying to retrieving the url for embedded ...
0
votes
0answers
13 views

Getting more detail from rake assets:precompile?

Having a series of problems when using Rail's asset pipeline over the course of my project. Inevitably, I spend a few hours fiddling with whatever asset files I changed in the hopes of finding why ...
0
votes
2answers
22 views

Rails trying to connect to unconfgured MySQL on request

Seeing a weird problem starting a Unicorn server - bundle exec ruby unicorn_rails.rb starts okay, but when I visit a URL, it shows: Mysql2::Error (Can't connect to local MySQL server through socket ...
0
votes
1answer
17 views

how to override HABTM table in rails

I am having using rails 3 and have an HABTM(has_and_belongs_to_many) between users <-> emails Also user have roles defined for users as subs, pubs which have a Model that references to itself for ...
0
votes
1answer
24 views

undefined method `save' for 15:Fixnum

I'm following this tutorial, http://guides.rubyonrails.org/ . In the tutorial, the examples just accept input from user and it's done. But in my code, after receiving input, i would need to get the ...
0
votes
2answers
24 views

Best practice: multiple CoffeeScript files on a page

I'm developing a page on my rails app that displays analytics data. It has to make several calls to the Flurry Analytics API to retrieve different events. I'm displaying each piece of data in a div ...
0
votes
0answers
8 views

How to disable the asset request log like cache: [POST /advanced_personality/1] in test env?

Using rails 3.2.11, and running the acceptance spec: bundle exec rspec ./spec/acceptance/sparkmaps_spec.rb:429 While it runs, the stdout shows long list of asset like: cache: [GET /users/sign_up] ...
0
votes
3answers
24 views

Rails: Flash Messages not appearing anywhere

So let's say I have code like this: class PostsController < InheritedResources::Base # Add before_filter here and devise should handle the redirection if the user is not signed in. ...
0
votes
1answer
16 views

Dont include all javascript files rails

I created an site and some javascript and css files that i only use on one site, disturb functions on other sites. But i dont know how to exclude files from the asset pipline. In the asset javascript ...
0
votes
1answer
34 views

Ruby SOAP Client using SAVON not working whereas PHP SOAP client works

Hello there I am new with web services and I am trying to write a client using SAVON with my wsdl. I have one available operation named log_process and I am trying to access that .I have the similar ...
1
vote
2answers
24 views

Show error message in Flash alert Rails 3

If i set a validation message up within my model validates :name, :presence => {:message => 'The name cant be blank.'} How do i get that message to show up in a flash alert, this is what i ...
0
votes
2answers
46 views

Why do we declare a @page = Page.new under new action, in Rails?

This question is about Rails 3.2 and a bit more complicated than the title suggests. Say we have a Pages controller, with all the RESTful actions. This web app can create pages, display, edit and ...
2
votes
4answers
82 views

Ruby on Rails - Ruby Operator Precedence - Parentheses

The following code results in an error Example 1 if params[:id] == '2' || params.has_key? :id abort('params id = 2 or nothing') end syntax error, unexpected tSYMBEG, expecting keyword_then or ...
0
votes
2answers
15 views

Twitter::Error::Forbidden - Unable to verify your credentials

I'm using devise + omniauth and I can connect to twitter api correctly. But when I try to use twitter gem, I have the following error in console : "Twitter::Error::Forbidden - Unable to verify your ...
1
vote
1answer
20 views

Clockwork and register_javascript_expansion exception

I use Sidekiq + Clockwork on Engine Yard. My lib/clock.rb looks like: require 'clockwork' require File.expand_path('../../config/boot', __FILE__) require ...
0
votes
2answers
19 views

Update all values in a column of different fields form (rails 3)

I have in my students table : id | fname | gname | course | year | ---------------------------------------- 1| user 1| user 1| IT | 5 | ...
0
votes
3answers
47 views

Reasons to choose Rails 4.0 over 3.2

I'm trying to convince my colleagues to chose the latest version of Rails for a bunch of projects we starting but kinda out of arguments. None of the new features look very exciting so it doesn't ...
0
votes
2answers
26 views

Custom Validations Rails Model

I have a contact form and would like to show individual messages depending on what has failed.I would like to use flash messages. So from what i have read so far i can create a custom method (or i ...
-1
votes
1answer
34 views

Why do I get “Uninitialized Constant” from Rails?

I created a route: user_currency GET /user/currency/:currency(.:format) user#currency This is my User controller: class UsersController < ApplicationController require ...
0
votes
0answers
26 views

Creating multiple nested_attributes for existing model

I have mongoid models in my Rails app as: class Company #Some fields end class Question field :name, type: String field :weight, type: Float accepts_nested_attributes_for :answers end ...
1
vote
2answers
65 views

Why this won't get faster even if I solved n + 1 issue?

I'm using the gem called "bullet" in order to avoid N + 1 issue. My previous code was @communities = Community.scoped.page(params[:page]).order("created_at DESC") Then I was getting this errors ...
0
votes
1answer
32 views

Rails app works completely fine in production but not in development mode on localhost

Ever since I deployed my app and compiled all its assets, it has been completely buggy in development mode but completely fine on heroku. The javascript does not fully work in development, and the ...
1
vote
0answers
13 views

Rails migration is always inserting whitespaces or changing the ordering of columns in the schema

There is a frustrating issue where my rails migrations update the schema with whitespaces and the position of the table's columns. So most times when I run bundle exec rake db:migrate it will do one ...
0
votes
0answers
6 views

Unforseen behavior in ActionMailer when trying to send mail within an ActionMailer class

I have an event inside the app that sends to two different emails to two different parties, but is triggered by the same event, so I bundled them together in a method like so class XXXX < ...
1
vote
1answer
14 views

Rails: get records for has_and_belongs_to_many association

How would I rewrite this request to get the articles available to the current_user if articles and templates have a has_and_belongs_to_many relationship? I feel like I'm close but I can't quite figure ...
1
vote
1answer
21 views

Why includes won't help to speed up?

I tried to use the gem called "bullet" in order to avoid N + 1 issue. My previous code was @communities = Community.scoped.page(params[:page]).order("created_at DESC") Then I was getting this ...
0
votes
1answer
23 views

How can I code if I want to avoid n plus one issue?

I have these 3 models Student Gender BloodType Prefecture Student has these three models such as Gender, BloodType, Prefecture. and each of them belongs to Student. Association is set up already ...

1 2 3 4 5 912