0
votes
0answers
3 views
Alternative for accepts_nested_attributes_for - maybe virtus
I'm relatively new to rails and finally found the right way to use accepts_nested_attributes_for.
However, there are some serious resources on the web who say that using accepts_nested_attributes_for ...
0
votes
1answer
8 views
How to avoid commenting out ruby version in Gemfile while working locally?
It looks like heroku is now defaulting to using ruby 2.0.0 out of the box when you upload a rails app.
One of my gems breaks due to some incompatibility issue that I don't really want to look into. ...
0
votes
1answer
20 views
Making one nested form_for use two different controllers
I have two models @product and @photo with @photo nested in @product. I am only allowed to use one form to create both. I am using this JQuery plugin to handle photo upload being how it gives me a ...
-3
votes
0answers
31 views
Ruby Script not showing output in command prompt on windows XP
I have installed ruby in my windows XP system. After that in command prompt when I am trying to check installation by using ruby -v its not outputting any version information and similarly when i am ...
-1
votes
1answer
17 views
Ruby on rails application in Windows Azure Virtual Machine
Hi i have created a ubuntu virtual machine in windows azure for deploying my rails application..
I have connected to my virtual machine through ssh and followed this procedure for deployment
...
0
votes
1answer
23 views
Where does rails hide js & css from a gem
I'm using gem 'jquery-fileupload-rails' and I am trying to fine tune the innate JS it is using. Where is it hiding in my app?
Thanks!
2
votes
1answer
30 views
Ruby Gem randomly returns Encoding Error
So I forked this gem on GitHub, thinking that I may be able to fix and update some of the issues with it for use in a Rails project. I basically get this output:
irb(main):020:0> query = ...
0
votes
1answer
24 views
Load Rails partial with passed values using AJAX?
In my Rails app users have folders, and inside these folders are posts that they can add. Right now I have the folders displaying in my view like this:
<% current_user.folders.each do |folder| ...
0
votes
1answer
15 views
Rails: Previous/Next in record when dealing with nested routes
I'm able to show previous and next links in my application, but I'm trying to figure out what happens if my link has nested routes?
For example my link is
localhost:3000/users/1/photos/2
I have ...
0
votes
1answer
17 views
Assigning Object to Association Not Working
I have the following model with their relationships:
class Account < ActiveRecord::Base
has_one :business, :inverse_of => :account
end
class Business < ActiveRecord::Base
belongs_to ...
0
votes
0answers
9 views
How do I make YUI use values for making a drop down?
I would like to make a drop down, but YUI gets my text input and uses it for classes of each items in the list.
Since I want to use localization in Rails (I18n) I would like to pass text and values ...
0
votes
1answer
16 views
Ruby: `gem_original_require': no such file to load — rails (LoadError)
I just deleted ruby 1.9.1 and installed 1.8.7, but my bash still points at 1.9.1 for when I look for rails.
emai@vpc-db:~$ rails --version
bash: /usr/local/bin/rails: /usr/bin/ruby1.9.1: bad ...
0
votes
1answer
16 views
Rails 3 respond_with returning associations
I have a simple Rails 3.2 controller which is consumed as an API with JSON:
module Api
module V1
class ReportsController < Api::V1::ApplicationController
def index
respond_with ...
0
votes
1answer
15 views
Creating a custom array with jBuilder
I'm trying to use jBuilder to construct a custom array which is the needed structure for my javascript function. In this case their is only 1 object in the array. I am aware of the array! method, but ...
1
vote
2answers
16 views
how to pass locals into a partial rendered with to_partial_path
I've been looking here and was wondering whether you can add locals to the shorthand notation for rendering collections of partials?
neither:
<% for contact in @contacts %>
<%= render ...
0
votes
2answers
23 views
How do I do auto conversion of Rails time to Unix epoch time?
I have a Rails app that makes heavy use of the created_at and updated_at fields.
I've found that something like Post.last.created_at.to_f will give me epoch time but I always need epoch time so I ...
0
votes
2answers
32 views
How to get the remote hostname in Ruby on Rails?
I am looking to resolve the hostname of the remote client in a Ruby on Rails app.
I know that Request.remote_ip will give me the client's IP address, but how do I translate that to their hostname?
0
votes
0answers
38 views
Cleaning up view logic
The following code generates a menu for filtering products. I have an identical filter, but for genres, and potentially other attributes I want to filter by. It seems like this should not go into the ...
0
votes
2answers
32 views
params.require().permit does not work as expected
I have this controller
class PeopleController < ApplicationController
def new
@person = Person.new
@person.phones.new
end
# this is the action that gets called by the ...
0
votes
0answers
9 views
Model a directory/file hierarchy in Ruby/Rails
I'd like to read in a list of filename & directory names from a nested directory tree. I'd like to build a hierarchy: and have each item (file or directory) point to its parent directory.
So each ...
-1
votes
0answers
15 views
Using .build to create multiple nested objects?
I'm a rails and programming noob. was wondering which one (or if either of these) will create multiple nested instances of session items held within an instance of a session? Or, you could just tell ...
0
votes
1answer
25 views
Rails 4 boolean checkbox not working
I have a model in which I have a boolean attribute, published. In my Post controller I have added it to my permitted attributes. Like this:
params.require(:post).permit([...], :published)
My index ...
0
votes
1answer
22 views
FactoryGirl and after_create callback in model
I have two models Board and Category with relation has_many/belongs_to.
In Board I have after_create callback creating default Category for it.
So when I create Board, it automatically creates ...
0
votes
1answer
16 views
Inheritance in Rails lib directory
I'm trying to make some classes inherit from a base class in the Rails lib directory.
The setup is as follows:
#lib/ab_tests/base.rb
module AbTests
class Base
# some methods...
end
end
...
0
votes
0answers
50 views
Rails render in controller outside of action
In the API I am building in rails, I've implemented some parameter checking and error handling in my base controller which the other controllers inherit from (to avoid duplicate code).
In my error ...
0
votes
2answers
32 views
Current year displayed in the coming years
In my application a user can fill in a form to create learning goals for the classes they take each semester at school. This application should guide them through their full 4 years of their study.
...
0
votes
1answer
14 views
mongoid before_destroy callback on has_and_belongs_to_many association
I have a simple has_and_belongs_to_many relation set up in Mongoid like so:
class Post
...
has_and_belongs_to_many :authors
scope :live, lambda{ published.where(:published_at.lt => ...
0
votes
1answer
28 views
Building JSON Object from array with specific keys and values in Ruby 2.0
I'm getting a bit stuck building a json object from a parent and child relationship. I have a Parent model with many Children.
I'm trying to create a JSON object as so:
{ parent_1.name: { ...
-1
votes
2answers
41 views
Getting the value of a GET parameter
I have a long link by which one can get to a page (it's about datatables).
...
1
vote
1answer
54 views
Ruby: What can cause execution of same codeblock to slowdown over time when ran over and over again?
I have a background worker in my rails project that executes a lot of complicated data aggregation in-memory in ruby. I'm seeing a strange behavior. When I boot up a process for executing the jobs ...