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 now available.
0
votes
4answers
36 views
Extract phone numbers from string using regex?
I need to extract some phone numbers from large strings in rails. These numbers will come in a variety of formats and could have multiple phone numbers in a single string.
Here is an example of the ...
0
votes
0answers
14 views
Javascript + Rails View rendering confusion
I'm using firebase for chat in one of my rails view and I'm not properly able to capture the value of user input to display on the page. This happened when I added the jquery plugin pageslide. I must ...
0
votes
1answer
13 views
Deface and a comment tag?
trying to get rid of comment tag from HTML.ERB file with use of Deface library.
Any idea what would be the proper selector for the following
<!-- Get "Open Sans" font from Google -->
?
Tried ...
0
votes
0answers
7 views
rails 3 JqTree Object has no method tree
I'm using rails 3.2 with jquery-rails 2.0.2 and jqtree-rails (0.1.5.0)
The included javascript files looks like this in my html page:
<script src="/assets/jquery.js?body=1" ...
0
votes
0answers
23 views
Why doesn't updating chat in realtime work?
I'm using private_pub to update a chat app, but I'm getting a strange error.
I have Room and Message classes. The Message class is:
class Message
include Mongoid::Document
include ...
0
votes
0answers
17 views
Two different types of user authorization
I have two different Users for my app. An Admin User and an Active User. For my User actions, for example, I want anyone visiting the page to have access to actions [:new, :create]. But only an ...
0
votes
1answer
9 views
Generate migration - create join table
I have looked through many SO and google posts for generating migration of join table for "has many and belongs to many" association and nothing work.
All of the solutions are generating a empty ...
0
votes
1answer
18 views
How can I setup a HABTM relationship between a model and several other models using a single table?
I'm having difficulty wrapping my mind around the necessary associations for the following situation:
I have an "upload" which can be attached to either a "person", a
"group", a "project", or an ...
0
votes
1answer
12 views
Ruby on Rails Payment gateway for customer based in the Philippines
I'm currently working on a project where my client is based in the Philippines. For Payment, I usually advice my client to use stripe although it's only available in US and Canada. For Philippines can ...
0
votes
2answers
26 views
How to prevent spam in rails?
Does anyone know how to stop spam in rails? I've tried many solutions, which all has failed.
I have tried:
Captcha: I am currently not a fan of captcha since it interrupts when the user is signing ...
-1
votes
1answer
41 views
Rails Ruby - Handeling Nil in production vs development
I launched my site with phusion passenger on a server and everything seems to run smoothly exept one page.
Here I get the following error message:
NoMethodError in Identities#show
Showing ...
0
votes
1answer
13 views
Make help message appear below form field with Rails/devise/boostrap/simple_form
I'm a rather newbie on Rails/css3.
On https://login.mailchimp.com/signup, when you click on a form (:focus), a "help message" appears below. For example "what's your email address?" appears below ...
1
vote
0answers
14 views
Structuring secret links in Rails 3
In a rails application I am building I have a resource called buckets.
I am now tasked with creating secret links for these buckets, for example -
...
0
votes
0answers
8 views
Prawn PDF common definitions
I'm using Prawn to generate Rails PDF documents. I have 5 different pdf generations that have quite distinct code. However, they each have some common elements such as header, footer, and company ...
0
votes
0answers
18 views
Rails: Javascript not working in Production
So far here's what I've done.
I loaded assets in the Capfile: js still not working
http://guides.rubyonrails.org/asset_pipeline.html#precompiling-assets
I moved coffee-rails from the assets to the ...
0
votes
1answer
24 views
Is it possible to copy only not protected attributes from one model to another in ROR3?
I need to copy attributes from one model to another. So I'm explicitly setting them like this:
user = current_user.attributes.slice("id", "name", "surname")
user["user_id"] = user.delete("id")
...
0
votes
1answer
23 views
How would you use a regular expression in an activerecord scope
I hoping to use a regular expression in a scope.
scope :smith, where(:full_name => /(smith)/) #names that include the word smith
Is this possible I've been trying different approaches to ...
0
votes
1answer
20 views
Filtering an ActsAsTaggableOn belongs_to association
Using ActsAsTaggableOn I'd like to create a collection of TimeFrames that belong to an event that has been tagged with 'fun'
However, I'm getting this error "SQLite3::SQLException: no such column: ...
0
votes
0answers
16 views
Carrierwave/Minimagick - Cropping is always inaccurate, except when 'y' parameter is 0
Having implemented the ability to crop as shown in the Railscasts episode 182 (revised), I can't seem to get cropping work accurately. What is cropped is always the top 20% of the area selected in ...
0
votes
2answers
31 views
Rails display simple partial?
My steps so far: Ive created an new rails app:
rails new sample
cd sample
rails g scaffold Post name:string content:string
rails g controller welcome home
Next step i added to the welcome/home ...
0
votes
0answers
13 views
How to define rails observers path in application.rb?
I just want to define my all observer in single line now i have code like this config.active_record.observers = :user_observer, :studet_observer, :suggestion_observer,
:progress_observer, ...
0
votes
1answer
38 views
Why this won't get faster?
I had this everywhere in all controllers, and views.
if current_user
transaction
end
It's probably up to 100 if statement with current_user.
So I added this this below to ...
1
vote
1answer
13 views
Rails Jquery Mobile Radio Button Form
I have been trying to get a dynamic radio button form working in my mobile (JQM) rails 3 app for about 1 week now.
Here is what I need:
Dynamic radio button selection, with JQM Control Group, radio ...
0
votes
1answer
24 views
HTML Table issue grabbing data from two database tables
Iam having an issue getting data from two different database tables to display properly with in an HTML table. I'm sure I am just overlooking something and this is pretty easy, but for whatever reason ...
0
votes
0answers
8 views
How to add background/fill color to a bounding_box in Prawn
Is it possible to add a background color to a bounding_box in Prawn?
bounding_box([100, cursor], width: 80, height: 20) do
pad_top(7) { text "THIS IS TEXT", size: 8, align: :center }
...
0
votes
1answer
15 views
how to use content_for so that the content shows up in the layout
Am testing the content_for in my rails 3.2 app and following the rails guides but they are specific to the actual files and I cannot seem to get the yield to work:
application.html.erb file:
...
-4
votes
0answers
12 views
“tests UserMailer” line in functionaltest for mailer [on hold]
I'm following tutorial for rails apps and there is line tests UserMailer in class UserMailerTest < ActionMailer::TestCase . All my tests passes with this line, without this line and with line like ...
0
votes
0answers
34 views
Rails PG::Error: ERROR: value “214524245325432453” is out of range for type integer
This error is is triggered by PG before any validations like "greater_than". How can I handle this the Ruby way and not in the controller?
0
votes
1answer
10 views
Content_tag_for malfunction in rails 3.2
I have search results that I need to loop through. Each loop should give me two table rows. The code so far is:
<tbody>
<%= content_tag_for(:tr, @results) do |material| %>
...
0
votes
0answers
44 views
Rspec/capybara requests failing to see page content
Final Edit:
Thanks to @PeterAlfvin's suggestion that I focus on the application layout and the header, I was able to fix it. I haven't been able to figure out exactly what the problem was, but ...
0
votes
2answers
36 views
In rails 3.2.8 how do you create with one of your variables is another Model?
I have 2 models, State and Office.
Office has_one State
Office name: string, city: string, state: State
State belongs_to Office
State name: string, Abbrv: string
I'm new to ruby, so I'm figuring ...
0
votes
1answer
15 views
Ruby on Rails TDD Error with 'Bundle Exec Rspec'
I am working through Hartl's Ruby on Rails tutorial and am stuck on Section 3.2 where I am required to run a TDD using the command:
$bundle exec rspec/requests/static_pages_spec.rb
and I get this ...
0
votes
3answers
31 views
Render partial in new site, rails
Ok so far i created an new controller with:
rails g controller home settings
In the settings.html.erb i want to display an partial so that i simply added one line:
<%= render ...
0
votes
1answer
32 views
Save fillable pdf online
I am trying to e-sign with docusign on fillable pdf, but when I fill form of pdf and then sending it to docusign using docusign_rest gem, it is showing unfillable pdf.
So what I want to achieve is ...
1
vote
2answers
32 views
Is there any benefit in keeping generated timestamps?
I'm writing my first Ruby on Rails app, and I noticed that generating migrations adds timestamp columns to the table. I have used timestamps before (e.g. when ordering to find the newest record). Are ...
0
votes
2answers
50 views
ruby on rails routing error routing to the wrong page
class TweetsController<ApplicationController
def index
#include 'coordinates_controller.rb'
include SearchHelper
include ParamasHelper
@sql=a.search
...
-3
votes
3answers
52 views
Replace array's integer with another integer [on hold]
I have an array
array=[10000,415455,10000,4529856,25632,10000,45556,58456,25654]
I want to replace all 10000 with 00000
How can I do this please?
0
votes
1answer
15 views
How to get a label next in Columns in ActiveAdmin
I would like to get a label next to these inputs in the columns. I would like the label on the left of the input. I have tried a few different ways to add a label but I haven't been able with no luck. ...
0
votes
1answer
9 views
Why do I get a duplicated curb request?
I'm creating an application, which has authentication based on external API with login/register methods. I have a simple controller called RegistrationsController which fires a request using Curb.
...
0
votes
1answer
35 views
Render partial in normal page
In my views i have an folder called categories and in that folder an file index.
All worked good until i tried to render an partial in that site:
<div class="row-fluid">
<div ...
0
votes
1answer
28 views
Rails routing error, because of controller def
I'm a Rails beginner and created a def set_star in the Controller, to change an attribute onclick.
class EbmsController < ApplicationController
def index
@ebms = Ebm.all
end
def destroy
...
-1
votes
3answers
20 views
Rails find entries with specific atribute
Im rails beginner and tried to list only database entries with an specific attribute.
In this case number:string = '40829'.
But it didnt worked out for me, here is my controller:
def index
@ebms ...
0
votes
0answers
11 views
DKIM signing mails with RAILS 3.2
I am trying to send DKIM signed mails through my Ruby application . I have set up the DNS records for the DKIM and enabled it on my server as well. If I send a mail directly from the server command ...
-3
votes
1answer
48 views
Run ruby file in rails console [on hold]
I created a file ebm.rb to add new entries to a database in rails. The file looks like this, and is very long:
011200RM60000H = Ebm.new(:number => '36232', :text => 'Eingriff der HNO-Chirurgie ...
0
votes
1answer
14 views
having trouble to this “playlist_in_list.user.email” in rails
I am currently struggling to understand following piece of line. It is from partials inside views folder.
<span>Owner: <%= h(playlist_in_list.user.email)%> </span>
particularly ...
0
votes
3answers
47 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
18 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
1answer
31 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
23 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
36 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 ...