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.
0
votes
2answers
15 views
Trying to pickup user who owns a record from controller
I have a Comments controller which is utilised in 2 other controllers (Task & Ticket).
I'm trying to have it email the owner of the Ticket once a comment has been created to notify them that the ...
0
votes
0answers
4 views
Rails undefined method in deep level route
I have such routes (RoR generated them automatically, please don't ask about model: why so deep etc):
namespace :admin do namespace :catalogs do namespace :to do namespace :manufacturers do ...
0
votes
0answers
7 views
Strong Parameters create with belongs_to
I have a Course model which belongs_to a Grade. I'm trying to create a Course in my seeds.rb file by doing:
Course.create(
ActionController::Parameters.new(
grade: Grade.all.sample
...
0
votes
1answer
12 views
AngularJS: Retrieve newly created Record Id in CoffeeScript
To create a new record added from a form in AngularJS, I have:
task = Task.save($scope.newTask)
But I need to also retrieve the new id that was created upon save. The answer found here: Not getting ...
0
votes
2answers
14 views
Rails Parse Active record validation error
I have the following in my controller:
def create
equipment = Equipment.create(:name => params[:name])
errors = equipment.errors.messages
puts "equipment errors: " + errors.inspect
...
0
votes
0answers
30 views
redirect ruby on rails
Controller compositions
def create
@composition = Composition.new(params[:composition])
@lastProduct = Product.find(:last)
@productAsc = Product.order("updated_at ASC")
@lastProductUpdate = ...
0
votes
0answers
3 views
Swap in a temp table when testing ActiveRecord model for legacy table
We have a number of rails apps that access data in a legacy schema. When testing, we write stubs to avoid having to grant permission for the app's schema to write factory data into the legacy tables. ...
1
vote
0answers
9 views
Find out if user purchased ticket - Eventbrite API
I am using the eventbrite API through the eventbrite client gem to generate concerts from my site.
On my concerts#show page I embed the ticket widget for users to buy tickets. From there, users will ...
0
votes
0answers
7 views
Postgres Bulk Data Import and Populate Associated Data
I have a Postgres database that gets updated from various external sources several times a day, and each record has fields like company_id and user_id that need to get looked up from an existing table ...
0
votes
0answers
12 views
How do I scope hierarchical data when using shallow routes in Rails?
The Rails Guides say avoid deep nesting and limit yourself to one level. But this can introduce a security issue that no one seems to address in their examples. Here's an example:
# Before
resources ...
1
vote
0answers
5 views
ActiveModel::MassAssignmentSecurity::Error in ActiveAdmin only on newly created model
I have many models enabled for ActiveAdmin i.e. they are registered with ActiveAdmin with default behavior and working great.
When I generate new model and associated active_admin resource it shows ...
0
votes
0answers
6 views
How to calculate closest location with ElasticSearch _geo_distance with multiple locations
I successfully got ElasticSearch to return my results sorted on the distance from my given coordinates. Problem is that the distance that is being sorted on is the AVERAGE distance of the available ...
0
votes
0answers
5 views
CanCan ability limit to specific records not working with complex join
I'm using CanCan 1.6.10 with Rails 3.2.13
I'm setting up my Abilities for my Staff (rather than User) model. I have:
class Ability
include CanCan::Ability
def initialize(staff)
if ...
0
votes
0answers
6 views
ember.js updated - options.options.types is undefined
Set up:
DEBUG: -------------------------------
DEBUG: Ember.VERSION : 1.0.0-rc.5
DEBUG: Handlebars.VERSION : 1.0.0-rc.4
DEBUG: jQuery.VERSION : 1.9.1
ember-data.js: Last commit: 3981a7c (2013-05-28 ...
0
votes
0answers
18 views
DES3 decryption - translating C# to Ruby
I am trying to recreate a C# en/decryption method in Ruby using OpenSSL, but I keep getting different results. I'm no C# expert so I think I may have missed a step (a hash somewhere?) as the results ...