Tagged Questions
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.
1
vote
0answers
2 views
How to set up the SMTP settings for the ASO servers (Rails)?
I'm trying to set up a mailer using my email, which is hosted on A Small Orange (asmallorange.com). I've tried the following:
Every possible combination of settings, both with and without SSL
...
0
votes
0answers
3 views
Can't generate wicked pdf in rails 4
Hi everybody I'm trying to use wicked pdf in rails 4.
I follow this page https://github.com/mileszs/wicked_pdf.
I did:
gem install wicked pdf
Then I tried the command
rails g wicked pdf
### And ...
0
votes
0answers
14 views
What means '$ bin' in $ bin/rails?
guys. I'm trying to follow along the "Getting Started with Engines" Rails Guide's tutorial and found this:
$ bin/rails plugin new blorgh --mountable
When I type this on my terminal, I get:
bash: ...
0
votes
0answers
4 views
Undefined Method `attachinary_file_field`
I've been following the Github repo for attachinary and everything goes well until I try running the page - I get undefined method attachinary_file_field. I have no idea what's going on, can anyone ...
0
votes
0answers
3 views
RoR using commontator gem to enable registered user comments
So, I am using the Commontator Gem to enable comments on my rails app. I followed the set up and had no problem with it. I have a Pin model that acts_as_commontable and a User model that ...
0
votes
2answers
10 views
Ruby on Rails - Validations and Before Filter method to substitute User Inputted Values
In my Ruby on Rails app, I have a sign-up form, where users have to enter some data. I have strict validations that only allow entered values that are members of an array. This isn't part of my app, ...
0
votes
0answers
7 views
Devise Invitable error: The invitation token provided is not valid
Regardless of what I have tried and I have looked through this Github thread, I keep getting the error The invitation token provided is not valid!
I have the form embedded onto a separate page on my ...
0
votes
1answer
9 views
Rails view is printing certain values we want from a hash and then the full hash - WHY?
We're trying to build a feed of submitted comments and articles, calling and showing only certain attributes of each. We're able to get a feed of sorts, but the page is also returning a hash of all ...
0
votes
0answers
12 views
How to validate file size of file before upload?
I am using Carrierwave to handle my file uploads and now I would like to add validation so users can't upload files of 1GB or similar.
For now I have done it like this:
class Item < ...
0
votes
0answers
7 views
FactoryGirl + Faker - same data being generated for every object in db seed data
I am using FactoryGirl and Faker to generate user objects in my seeds.rb file but for some reason the exact same user is being created and rake db:seed is failing because of an email uniqueness ...
0
votes
0answers
9 views
Rails 4: devise custom routes
I want to have a "Account Settings" page, which is for editing name and password, and a "Profile Edit" page, which is for updating profile picture and personal information. The default devise path for ...
0
votes
1answer
13 views
undefined method `valid?' testing with FactoryGirl
I'm performing the simplest test on the following class (inside model's folder):
class Offer
attr_accessor :title, :payout, :thumbnail
def initialize(title, payout, thumbnail)
@title = title
...
0
votes
0answers
17 views
Rails JSON API: add top level element to get by id API
I have a JSON API that returns a collection of objects, API is using to_json and ActiveModel::Serializer to generate the JSON. I get JSON with structure that looks like this:
{
"objects": [
...
1
vote
5answers
40 views
Bringing values into a loop in Ruby
This is almost certainly a duplicate, but I can't find the original - I don't know the search terms to use. Which is why I'm on Stackoverflow instead of Google :)
Anyhow, here's my code:
def ...
0
votes
0answers
6 views
How to override redmine.rb permissions in plugin init.rb
I am developing a redmine Plugin which has the task to offer some additional allow/disallow options, one of the features should be that the admin can allow/disallow the access to issue reports for ...
0
votes
0answers
10 views
Tried Webscraping with XPATH, Nokogirl, Mechanize
I have been tring to parse some information from the saferweb siteand am having issues getting it to work
if i can get the first value i can adapt it to get the rest...
This example should return ...
-1
votes
0answers
11 views
default_scope on joins/includes multiple association levels in rails
I have a model with different levels of association, represented with the schema below:
Generally, I always need to get an offer details through the product and its properties.
The problem is when ...
-7
votes
1answer
43 views
Intensive Code Course. Ruby on rails or Front End Engineering [on hold]
I'm actually deciding if I'm going to do a course of Front End Engineering or Ruby on Rails. I'm not very good a matching colors or stuff like that and I have low experience with Adobe programs like ...
0
votes
0answers
10 views
Can Devise request_keys be optional?
I am trying to authenticate by subdomain but cannot seem to get devise to behave the way I'd like. I've been through the devise wiki and didn't see the answer to my question.
In my devise.rb:
...
0
votes
0answers
17 views
Rails: A way to check for duplicate item in DB? Affiliate data feeds
I have a problem regarding affiliate data feeds.
For example from Amazon or other e-shop partners. I am trying to import their product data, but want to avoid having duplicates, if both shops sell ...
-3
votes
3answers
25 views
What is the anatomy of a web app?
I've worked through Michael Hartl's Rails tutorial and it seems like he's built a fairly full featured web application using only Ruby on Rails. But, after doing some reasearch, it seems that web apps ...
0
votes
2answers
19 views
Create a record in Rails from AngularJS
I have an Angular application that sends http requests to a rails server. I'd like to make a request to create a record (in the table SavedQueries).
The Angular app is actually making a very simple ...
0
votes
0answers
5 views
Rails cache_digests and AbstractControllers
I have a class that I use to render some pdfs inheriting from AbstractController
and I'd like to use cache_digests in the views
class PDFExporter < AbstractController::Base
include ...
0
votes
0answers
5 views
Order based on existence of tag, acts-as-taggable-on gem
I'd like to order a query based on the tags associated with a product. If the tag exists it should be placed at the bottom of the query. I am using the acts-as-taggable-on gem to manage tags for the ...
1
vote
1answer
26 views
Rails test if a value fits with the type of a column
I need to check if a value fits with the type of a column, something like this
1.is_a? Product.columns_hash["id"].type
"a".is_a? Product.columns_hash["id"].type
But ...
0
votes
1answer
13 views
form_for details not displaying in view :Ruby on Rails
Hi I am using simple form_for to create new object but on the ads/new.html.erb on h1 tag is displayed but form's information is missing
Here is my new.html.erb file contents
<h1>New ...
0
votes
0answers
27 views
Syntax error when running 'bundle install' for Gemfile
I'm following Michael Hartl's tutorial on Chapter 9 (http://www.railstutorial.org/book/updating_and_deleting_users).
Whenever I edit my Gemfile and manually type in a gem that I'd like the install, ...
-4
votes
1answer
14 views
Rails - multiple users updating the same field [on hold]
I want to create an effect similar to google docs where multiple users can edit the same document and can see the other changes. Any advice/gems to use?
1
vote
0answers
31 views
Disabling paths in Rails
I'm trying to figure out how to disable the Rails magic of loading paths by default.
For example Rails has these paths.
Rails.config.autoload_paths
Rails.config.eager_load_paths
Rails.config.paths
...
0
votes
1answer
25 views
Rails file field being interpreted as String?
I am trying to provide a form field to be a file input on a rails site. My form is set up like the following
<%= form_tag({:action => 'submit_bulk_adjustment',:id => 'uploadForm', ...
2
votes
1answer
9 views
rspec 3 - stub a class method
I am upgrading from rspec 2.99 to rspec 3.0.3 and have converted instance methods to use allow_any_instance_of, but haven't figured out how to stub a class method. I have code like this:
module MyMod
...
0
votes
1answer
12 views
Rails/Heroku - How to create a background job for process that requires file upload
I run my Rails app on Heroku. I have an admin dashboard that allows for creating new objects in bulk through a custom CSV uploader. Ultimately I'll be uploading CSVs with 10k-35k rows. The parser ...
1
vote
3answers
18 views
Trouble displaying associated records in Rails
I am working on a rails app that has two tables - customers and jobs. A customer can have many jobs and each job belongs to a customer. I have my associations set up and working accordingly.
I am ...
0
votes
1answer
35 views
Why am I getting `method_missing`?
I'm not sure but I think my something may not be right with my relations? I'm getting method_missing. Is it because I'm getting an Array back from active-record.?
event = Event.last
Event Load ...
0
votes
1answer
15 views
Unpermitted parameters in a simple scaffold
I have 2 models Post and Photo:
class Post < ActiveRecord::Base
has_many :photos
end
and :
class Photo < ActiveRecord::Base
belongs_to :post
has_attached_file ...
-4
votes
2answers
31 views
Just advice from your experience [on hold]
advise what to do, how to move on? Read a couple of basic books, attended a courses like _ codeacademy, rails for zombie ... What's next, what to do what to read, etc.? .. Just advice from your ...
3
votes
1answer
25 views
Can you use AngularJS with Rails Models
If the title question is unclear, let me clarify. Though the question is conceptual, rather than physical.
I have a rails application with a few models (order, buyer). I recently discovered angularjs ...
-1
votes
1answer
16 views
Optimizing multiple Active Record queries in one line
I'm unfamiliar with Ruby and trying to figure out how best to use ActiveRecord. Currently, I have a problem where I get an ID from one object, and then want to use that ID to search for another object ...
0
votes
1answer
19 views
rails dynamic data hover over
I am trying to create a hover over action for items inside of a dynamically created loop. I have no idea what the object names are or how many there are. As of now, I have the list printed correctly ...
0
votes
2answers
19 views
Rails 4: Nested Attributes Not Showing on Form
I am trying to run through a simple nested_attributes exercise, where a question has many answers (how like life is that?). I can't get the answers field to show up in either the 'new' or the 'edit' ...
0
votes
1answer
13 views
AngularJS application not downloading file
I have a rails server that generates a csv from an http request, like this:
@results = some_json_string
require 'csv'
csv_string = CSV.open("results.csv","wb") do | csv|
...
0
votes
1answer
19 views
Has many through association with boolean attribute
I have three models. Organizer, Organization, Connection.
# Schema Information
#
# Table name: connections
#
# organizer_id :integer
# organization_id :integer
# admin :boolean ...
-8
votes
7answers
66 views
Printing 0 to 50 inclusive?
Why is this code not printing 0 to 50 inclusive?
i = 0
until i <= 50 do
print i
i += 1
end
0
votes
1answer
14 views
Rails 4. Country and Region/State validation in model
I have a table User
create_table :users do |t|
t.string :first_name
t.string :last_name
t.string :country
t.string :region
t.string :city
t.timestamps
end
I need to validate ...
0
votes
2answers
26 views
Rails querying databsae [duplicate]
I am trying to create an instance Object of all Users that have one or more Video in my controller, so there is one User that has many videos. So I have a User.rb model that has_many :videos, and my ...
1
vote
0answers
14 views
Require Node.js dependencies in Ruby/Rails gem
I'm having a great time live-reloading JS with fb-flo in my Rails & batman.js project. I want to move my code into a Ruby gem, but I don't know what to do.
To run the flo server, I'll need to ...
0
votes
1answer
14 views
Log out of app with cURL
We have a web app built in Ruby on Rails that uses Devise for logging in and out. I'm responsible for a backend XML API using cURL. Users can log in, send updates, etc. at a command prompt with cURL ...
2
votes
0answers
36 views
Rails 4 has_many through many
I'm stuck on this:
class Worker < ActiveRecord::Base
has_many :skills
has_many :jobs, through: :skills
..
end
class Skill < ActiveRecord::Base
belongs_to :worker
has_many :jobs
..
end
...
-3
votes
1answer
20 views
How do I access data in the view from my controller? Rails [on hold]
I have data I'm getting in my controller and want to display it in the view. I've tried using a helper method but no luck. I've also tried an instance variable but still doesn't work.
0
votes
2answers
16 views
Create Active Model datetime with Epoch Timestamps
I have a mobile application that can create events by sending a Post request to our Rails application using the standard routing for a SimpleEvent model. The important pieces of the model look like so ...