0
votes
1answer
17 views

How to add filtering to find users by City, Gender, Photo and Age?

In my Index view, I want to be able to filter users based on city, gender, photo and age. Currently I only have filtering by age. I want the options for City and Gender to be in a select list and the ...
0
votes
0answers
30 views

How to define methods dynamically for action mailer

I need to send various email like user_mail_#{type}for#{transaction_quantity}_#{transaction_status}. here type, transaction_quantity and transaction_status can have multiple values. I want to define ...
1
vote
2answers
15 views

How to allow users to view individual instances of a resource but not the index with CanCan?

I'll try to be more clear than the title. I want users to be able to view all individual widgets which might be at the following URLs: /widgets/2 /widgets/3 /widgets/45 But I don't want users to ...
0
votes
2answers
30 views

Send JSON data as post method from rails controller to a web service

I am trying to send some json data from my controller written in rails to a java webservice. On form submission i take all the input fields data do some procession on it and convert it into json ...
0
votes
1answer
23 views

Error while retriving data from database mysql

the following is the code in which i got error while retrieving data from database in ROR. <div class="container"> <div class="row"> <div class="span9"> <h2> List ...
0
votes
1answer
24 views

In a Rails 3.2.13 app, I'm generating an index incorrectly

In a Rails 3.2.13 app I am using the query_reviewer gem to improve my database performance. The code generating the SQL is: @seo_keywords = SeoKeyword.order("category, keyword") It generated the ...
0
votes
1answer
28 views

Button set on Disabled but still I can click on it

This is the HAML code I have: %a.btn.btn-primary.personlistbtn{href:patients_path, :target => "_blank", :disabled => 'disabled'} Person List And this is how it looks on Inspect Element: ...
0
votes
1answer
23 views

Routes currently require literal id of model attribute, rather than what would make sense given the context

My app basically consists of a user taking a course, and going through various steps to complete the course. However, I believe there is a problem with my routing. Right now here is the route for ...
0
votes
1answer
30 views

Processing two unassociated Rails models' forms in one controller action

I'm creating a Rails app that will take in input from two models and their respective forms, and then log into a website with Mechanize and do hundreds of tasks there. The first form consists of the ...
0
votes
2answers
21 views

Having access to Global variable in all controllers

Probably not the best practice but for a quick prototype work I need this: in a method in one controller I am assigning a value to a global variable like this: @@globalVar = someValue Now in the ...
1
vote
1answer
37 views

Ruby on Rails - routing error, goes to “show” instead of “index”

I have a basic homepage with a link that I would like to go to businesses/index.html.erb <%= link_to("Go to businesses index page", {:controller=>"businesses", :action =>"index"}) %> ...
0
votes
1answer
14 views

Target Blank not opening the link in a new tab

I have this in my HAML: %a.btn.btn-primary.personlistbtn{href:patients_path, :target => "_blank"} Patients List And it has generated this in HTML form when I do an Inspect Element on it: <a ...
-3
votes
1answer
39 views

How to strore and retrieve data with html code in ROR [on hold]

I am a beignner in ROR, need some help regarding database storing and retrieving values my controller class is demo_controller.rb and following is the class code.. class DemoController < ...
0
votes
1answer
27 views

Starting rails server having error for a mysql project

i'm using ruby version 1.9.3 p448 and rails version 3.2.13 all of my gems are upto date. i create a project with the following code rails new simple_cms -d mysql but when I start rails server with ...
-1
votes
0answers
20 views

Hosting service for redmine 2.1.6 version

I am using Red mine in my company since last 3 months . I am using red mine -v 2.1.6,which is supported by ruby 1.8.7 and rails 3.2.11 well now my question is since i have made many customization in ...
1
vote
3answers
44 views

Rails how to improve if record exists?

I have this model: class Device < ActiveRecord::Base has_many :events def last_event events.last end end As you can see, I have a method to get the last event for the device. Now, ...
0
votes
1answer
18 views

Generating simple passwords based on dictionary words in Rails

Is there an easy way to generate simple passwords in Rails? I'd like to just grab 2 random dictionary words like AOL used to do a long time ago (I know that isn't very secure, they don't need to be ...
0
votes
3answers
51 views

How to duplicate a record in Rails except for one attribute?

In my Rails application I have a method that duplicates an invoice including its items. class Invoice < ActiveRecord::Base def duplicate dup.tap do |new_invoice| new_invoice.date = ...
0
votes
1answer
18 views

rails: getting most recent record within a loop

I'm trying to get the most recent record if I have a loop. I'm getting an error with this syntax: <% @user.pictures[0,5].order('created_at DESC').each_with_index do |s, i| %> <% link_to ...
0
votes
1answer
37 views

Rails 3.2.13 - Delete Entry From Nested Attributes

I have a Ruby on Rails 3.2.13 application where I have a collection_select statement. The collection_select statement is in a fields_for statement where I gather selected ids from the ...
0
votes
1answer
18 views

Rails Asociations - Multiple users fullfilling different roles for single model

I'm sure this has been answered before but I'm just not searching for it correctly. I'm struggling with associations today. I've tried so many ways to get it right and now I'm fuzzy. I have 2 ...
1
vote
0answers
19 views

Rails 3.2 - collection_select Adding A Null Entry In The First Position Of My Array

I have a Ruby on Rails 3.2.13 application where I have a collection_select statement. The collection_select statement is in a fields_for statement where I gather selected ids from the ...
0
votes
1answer
24 views

How to store user's preferred currency format in Rails application?

I want the users of my international, multilingual Rails app to be able to set their own currency and currency format. Right now, I am using translation files to achieve this: de: currency: ...
0
votes
1answer
21 views

ActiveRecord polymorphic has_many with ActiveSupport::Concern

I have the following Concern: module Eventable extend ActiveSupport::Concern # ... included do has_many :subscriptions, as: :entity, dependent: :destroy end end My Models are: class ...
0
votes
2answers
45 views

How to remove blanks from Rails' simple_format() output?

I am using Rails' simple_format() to output addresses from my database like this: <%= simple_format(@person.address) %> As I result I get this markup in my Safari browser: <p> "John ...
1
vote
1answer
11 views

Using ruby to make a class active via helper method - error in variables

I have been having problems with my coffeescript, so instead I would like to use ruby to make my classes active in the view when clicked. I created a helper method called nav "active", and I have a ...
0
votes
1answer
12 views

Attaching parameters to the URL of a Rails route

This is a silly question but weird enough I Googled it, I am sure i had seen it before in Rails guides but now couldn't find it. I want to attach parameters to my URL. My initial url is this: ...
0
votes
1answer
16 views

rake db:multi:migrate DATABASE=configuration error with JRuby, mysql, riak

JRuby 1.7.1 and Rails 3.2.11 In terminal I'm running "rake db:multi:migrate DATABASE=configuration" but I keep getting the error below meaning as far as I can tell that the configuration database is ...
0
votes
1answer
21 views

What are the different methods that i can use to authenticate user from rails server which is a backend of iOS?

I use rails as backend for ios applications. So far i have been using devise as it looks flexible and comfortable to use with less effort . And i have read about omniauth and that too looks easy to ...
-1
votes
0answers
21 views

Rails app with SEO keywords in the URLs

I have a non trivial Rails 3.2 app (it has several sections alongside with a shop managed by Spree Commerce). Because of a SEO consultation we received, we need to change the URLs, which now look like ...
1
vote
0answers
43 views

Confused about passing parameters from JavaScript Ajax call back to controller to render a form

Scenario: I click on some objects,table rows,etc on my page and I get their IDs for example I click on Providers list and get provider_id. And then I click on a button on the page: Now I have a ...
0
votes
1answer
14 views

Rails Active Admin Coffescript not compiling in production

Rails 3.2 I have a coffee script file which works fine in development. When I push to prod I get this error when I go to the login page: ActionView::Template::Error (utils.js.coffee isn't ...
0
votes
0answers
16 views

Defining CanCan abilities in engine

I'm trying to write an engine for a rails 3.2 application that uses CanCan for authorization. I'd like to continue defining the abilities for the engine's actions in the engine's ability.rb file, but ...
1
vote
1answer
23 views

Authentication & Roles management for different users, howto solve this?

Could you help me to solve this ? I'm creating a management application with to different users : "User" they are definided in app, that's management person, won't change, and "Student" they are ...
0
votes
1answer
35 views

Ruby on Rails decimals?

I have a Migration in my database that has a t.decimal type called decnum. I have tried doing things like mdl.decnum = 3.3, and mdl.save, but it just saves decnum as 3, instead of the decimal defined. ...
0
votes
0answers
29 views

How to enable Cross Origin Resource Sharing in Rails application?

I have developed a Rails Application which servers as a back-end for mobile devices.Now i am trying to access my Rails Resource through Web Application.I tried creating an sample web application ,but ...
0
votes
1answer
27 views

Accessing Nested Attributes When Doing Error Checking In Controller

I have a Ruby on Rails 3.2.13 application where I have one model related to several models. I will give information about one of them related models to explain the scenario. I have new and edit ...
0
votes
2answers
39 views

What is the difference between these two clips of code?

What is the difference between these two clips of code? The first clip is labeled "This one:" and the second clip is labeled "And this:". (.rb) class Reseller < ActiveRecord::Base attr_accessible ...
0
votes
2answers
21 views

Parent-Child form

How do I show a parent-child relationship on a single page in Rails? I don't need a form as I simply want to show the information (no edits or updates required). The parent is customer and the child ...
0
votes
0answers
11 views

enable asset pipeline for an engine only

My main app was recently upgraded from Rails 2 to Rails 3.2. We have yet to turn on asset pipeline. However, I am making an engine to be mounted in the main app and would like to use the asset ...
1
vote
1answer
23 views

What's the best way to create an engine for an engine in Rails?

I am working with an engine in Rails and I'd like to extend its functionality with additional models and controllers in a modular format. My idea was to create an "engine for an engine." Is this the ...
0
votes
3answers
27 views

How to set a background image in rails from css?

I am using rails 3.2 and i have to set a background for one of the page and i have tried many ways and nothing went right, so looking for some good help. I have tried background: url(<%= ...
0
votes
0answers
31 views

Better way to make nested resources?

In routes.rb I have the following code to create nested paths for students and subjects under student_groups: resources :student_groups do resources :students, :subjects end I then want to nest ...
1
vote
1answer
26 views

Dual-parent nested resources or is polymorphism right for me?

I have a model called evaluation that belongs_to two other models - student and goal. While researching how to set up this association for routing, at first I thought a polymorphic association would ...
0
votes
0answers
14 views

Rails rack middelware image proxy ActionController::RoutingError

After updateing to Rails 3.2.13 from Rails 3.0.9 my rack middelware image proxy is broken. On localhost the image is served but I still get a routing error: Started GET ...
0
votes
0answers
23 views

selecting the next and previous radio_button_tag in jQuery (.js.erb file)

I have a list of elements and each of these elements has three radio button with unique IDs like "deal5" and "deal6".. each one of these radio button is in its own form_tag. I want to -select the ...
1
vote
1answer
39 views

Rabl.render: how to use view helper methods?

I'm using Rabl to generate XML output in a rake task: xml = Rabl.render @listings, 'feeds/listings', :format => :xml # do stuff with xml However, I need to use multiple helper methods in the ...
0
votes
2answers
27 views

More precision for time_ago_in_words and distance_of_time_in_words in Rails

Are there any options to make the time_ago_in_words or distance_of_time_in_words functions more precise in Rails? Their documentation mentions options but doesn't specify what they are. If I pass in ...
0
votes
1answer
35 views

Pass Rails Error message from model to controller

I have a method in my model which parsers an API and returns the data: def self.get_item_info(date, time, limit) url = URI.parse("#{end_point_url}/#{date}?mRange=#{time}&limit=#{limit}") ...
0
votes
5answers
99 views

How to remove mysterious whitespace from line breaks in Ruby on Rails?

In my Rails application I have a field address which is a varchar(255) in my SQLite database. Yet whenever I save an address consisting of more than one line through a textarea form field, one ...

1 2 3 4 5 58
15 30 50 per page