Tagged Questions
0
votes
0answers
20 views
undefined method `handle_asynchronously' for AsyncTask:Class
I get this error when I try to run delayed job in my controller. Have anyone else come across it before?
I have followed all the steps on the git file for the gem and it installed correctly.
I ...
2
votes
3answers
66 views
Should I move my custom methods to model from controller?
Let's say I have a Product model and ProductsController. Controller has all the standard CRUD method and Product does all kinds of validations etc.
Here is an issue.
I have several custom very ...
0
votes
2answers
38 views
Should I use partial or show.html.erb?
I'm writing a web app containing posts and comments. Since there are many places I need to display a bunch of posts with their comments, I'm thinking about reusing the code. But I'm not sure if it is ...
1
vote
3answers
55 views
Organizing site navigation actions in Rails
I'm new to Rails (I've worked in MVC but not that much) and I'm trying to do things the "right" way but I'm a little confused here.
I have a site navigation with filters Items by different criteria, ...
0
votes
1answer
49 views
Converting Ruby code into Ruby on Rails Web Application
Let me preface this by saying that I am very new to Ruby and Ruby on Rails, and have been unsuccessful in finding a clear demonstration of translating a working Ruby program to a web application ...
1
vote
1answer
40 views
Changing a field in the users table after_create of a record satisfies a condition
I want to change a users workout_id in the Users table once he completes his workout. I can't figure out how to do this. Below are the two ways I've tried to figure this out.
Attempt 1: Put an if ...
2
votes
2answers
32 views
render ActiveRecord response in from Controller to View
I'm new to Rails. I'm using Rails 3.2.13. I'll try to keep my question succinct:
In my controller, I want to get the last 10 entries from the Observation table. I have:
def index
@times = ...
0
votes
1answer
16 views
Check for a field in the first table. If returned true the submit the form, if not then raise an error
Here is the first part of code in the Products#create action
@tmp = params[:product]
@tmp["items"] = @tmp["items"].split(',').map(&:strip)
@org = Product.new(@tmp)
@company = ...
0
votes
2answers
28 views
Can rails controllers be inherited to a third level deep?
Can I have controllers in Rails that are 3 levels deep inheritance? One would think such a trivial thing is possible, but the concrete controller at the "third" level gives the generic/useless error ...
0
votes
0answers
50 views
suddenly started getting NoMethodError in Static_pages#home - undefined method for nil:NilClass
This is a follow up from this question that I posted yesterday
how to get the actual username to display instead of #<User:0x5424a68> (ruby on rails 3)
I was able to get everything working fine ...
1
vote
1answer
300 views
Binding Angular.js actions to Ruby on Rails actions
I've been using rails a while and am starting to fiddle around with integrating Angular.js. To get myself going, I'm making a simple (you guessed it) todo app.
In my rails controller, I've made a ...
0
votes
2answers
48 views
How to render correct view on save failure during form sending?
I am using high_voltage for create various number of landing pages.
On these pages I have different fields for creation User model.
Each form has email and random other fields.
For example:
# ...
-1
votes
1answer
38 views
Issue with scaffold in Ruby on Rails
I'm trying out a few things in Rails and I got a particular issue with the scaffolding process. It might be something I'm not familiar with, let me show you what I did:
First:
rails g controller ...
0
votes
1answer
24 views
Submit Button runs the Create method, not Logon
We implemented a simple login method for our Ruby on Rails project, we have a button on the page to submit for the login information that the user will enter, but instead of pointing to our login ...
-1
votes
1answer
39 views
Create several records of the same table in one click
I have a questionnaire that needs to be answered.
My model has table answers and table questions and i pass correctly but I get an error
undefined method 'each' for nil:NilClass
I just need a ...
0
votes
1answer
37 views
Refering a model in sub-directory in rails
I'm writing a Rails Application.
My model tree looks something like this:
models/
|- user.rb
|- ...
|- forum/
|- thread.rb
|- forum.rb
A user has many threads.
When I try this:
has_many ...
0
votes
3answers
40 views
Organize Rails view so thats its a little easy to read
I have the below code
<% @data1.results.map do |s|%>
<%if params[:data1].empty? == true%>
s.product.text
<!-- More content to come-->
<%else%>
...
1
vote
1answer
43 views
Rails create new MVC
I would like to create a model called models/thing.rb, a controller called controllers/things_controller.rb, and views called views/things/index.html.erb and views/things/hello.html.erb.
How do I do ...
0
votes
2answers
56 views
Multiple Rails controller requests on one page
The other day I stumbled on Sandi Metz's rules, and one of them reads
When a call comes into your Rails controller, you can only instantiate one object to do whatever it is that needs to be ...
0
votes
1answer
21 views
Creating a multi-level association rails
I'm trying to develop a job board style web app.
In my current model:
entrepreneur has_many :opportunities
opportunity belongs_to :entrepreneur
So basically the opportunities model is the table ...
1
vote
1answer
174 views
ruby on rails update page with ajax
I am using below button_to tag inside view file (index.html.erb)
<textarea rows="2" cols="20"><%=@write_date%></textarea>
<%= button_to ...
1
vote
2answers
386 views
superclass mismatch for class CommentsController (TypeError), best way to rename?
I ran into some problem tonight while deploying and I'm trying to get this fixed asap
I have no idea why this is happening. Everything works fine locally but not on heroku. I tried all sorts of ...
0
votes
1answer
21 views
NoMethod Error - One to Many Association
Trying to debug something for hours which is not making any sense
The error is:
undefined method `proposals' for nil:NilClass
I have two one-to-many associations in the following models:
...
0
votes
2answers
46 views
How to make Rails app perform an action depending on if a checkbox is checked? (RoR)
I have a checkbox in a view called post_form.html.erb that someone uses to post. Here's the full code of it below:
<%= form_for @post, :html => {:multipart => true} do |f| %>
<%= ...
1
vote
2answers
123 views
How to validate presence and regex format in rails controller?
I am trying to validate an email address.. whether it is present or not.. and whether it meets a regex criteria (/xyz/). I really need to do this on the controller or view level in rails as I am going ...
1
vote
2answers
68 views
Instance of Rails model only creatable through console
I've been following the tutorial on creating a Rails blog (http://www.roberthuberdeau.com/articles/4-How-to-create-a-blog-in-Ruby-on-Rails-3) and have basically got all the way to the end.
However, ...
0
votes
0answers
31 views
Have rails load the layout first and then process whatsoever there is in the controller. Or what is some other good method to deal with api calls
I am doing a twitter api call from my controller. Maybe a bad idea,but I am new to rails and still learning. Now the thing is, it takes a while for the page to return the basic body, head the final ...
0
votes
2answers
76 views
Rendering rails partial with dynamic variables
I'm trying to render a partial based on the taxon the user is inside. In my application.html.erb layout I have the following line of code:
<%= render 'spree/shared/women_subnav' if @enable_women ...
0
votes
0answers
100 views
Controller Test to Signup with OmniAuth
I use MiniTest as test framework and OmniAuth for authantication. First I want to signup and write a controller test. There is no trouble and user could signup, but when I run the controller as like $ ...
0
votes
2answers
47 views
Restrict access to “destroy” feature in Ruby on Rails app
Thanks in advance for your help! I have a site built in Ruby on Rails (2.3.15, 1.8.7) that lets people create itineraries to different locations and with different activities at each location. The ...