Tagged Questions
0
votes
2answers
19 views
Where should I put chart-drawing code in Rails?
I've got some custom Ruby code for generating a chart (which will generally be displayed as an inline SVG in a "show" view) based on the contents of the model.
I'm wondering where I should put the ...
0
votes
2answers
31 views
Rails - best place for helping code
It is a best practices question. I have a model storing some parameters, used for generating a javascript file. One model instance generates one file. I use erb template for params substitution. ...
0
votes
2answers
36 views
Creating an index view for a devise user
This is a new project, so scraping and restarting would be easy if someone has advice in that direction. Essentially I created users with devise by using:
rails generate devise users
But now I ...
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 ...
0
votes
1answer
60 views
Rails - Is it terrible to call models directly in views?
So I have a search partial that I want to be able to use anywhere in the site. I realize that it's generally bad to put logic in the view, but can I do something like
= form_for User.search do |f|
...
0
votes
3answers
30 views
How can I change the a column name in rails 3?
basically I accidentally wrote password_has instead password_hash and I thought by rake db:rollback I can make the appropriate changes and then do rake db:migrate and rake db:reset but seems like the ...
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
0answers
41 views
Ajax request in rails 3.2 hitting controller twice
I have an ajax call for my signup, but this ends up hitting the controller twice. I tested this using the debugger, so I am sure it hits it twice. Why does it do this?
Code for the controller is ...
0
votes
2answers
21 views
How do I handle models that should have one and only one row in their database?
It is common for customers to want to have control over their application without having to go back to the developer. In these cases, they usually request a simple CMS where they can edit otherwise ...
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 ...
2
votes
3answers
50 views
Rails best practice for similar controllers/views?
I'm writing an inventory management Rails app. I have class Product < ActiveRecord::Base, class Foo < Product and class Bar < Product. Foo and Bar have subtly different behavior, but using ...
0
votes
1answer
20 views
Rails why routing error? No route matches error with another controller
i dont understand
in routes.rb i have write
match 'promotions/search' => 'promotions#search',:as =>:search_promo ,:via=>:get
in the promotions_controller.rb i have add:
def search
...
0
votes
1answer
24 views
Rails why routing error? No route matches
i dont understand
in routes.rb i have write
match 'promotions/:id/purchase' => 'promotions#purchase', :as => :purchase_promo
in the promotions_controller.rb i have add:
def ...