0
votes
0answers
13 views
Rails / Activerecord DSLs
I'm working on a sports-related (baseball) rails application that intended to be an information / research tool for sports fans. Given the sports focus of my application and the various jargon and ...
0
votes
1answer
15 views
no routes to destroy an element of a child association
I have two models
Parent
has_many :children
Child
belongs_to :parent
And I would like to have a clean rails route to destroy children from parent.
resources :parents do
resources :children ...
0
votes
1answer
33 views
Associating Things
I'm creating a football database and I created two scaffolds: one called Clubs, that has some basic information (Name and Stadium, both strings), and another called Players. The players have names, ...
0
votes
1answer
15 views
add view helper to config/sitemap.rb
I have the file config/sitemap.rb. In my helpers/jobs_helper.rb, I have the method anything:
module JobsHelper
def anything
true
end
end
How can I use the method anything inside ...
0
votes
1answer
34 views
Create new user programatically with Devise
I'm using Devise to manage users in my rails app. I have a button available to admin users which leads to a form that allows them to create other admin user accounts.
When the form is submitted this ...
0
votes
2answers
48 views
How to get a string into a where clause in Ruby on Rails 3?
I have this class method:
def self.default_column
"created_at"
end
How can I rewrite the following function, so that I can make use of my default_column method?
def next
User.where("created_at ...
0
votes
1answer
42 views
Validation for create action causing routing error
Validation for the create action are not working, I have made validation for the field to be present, but if I keep the fields empty and press submit, I get routing error, if I fill in the complete ...
0
votes
0answers
22 views
How redirect subdomains to multiple controllers on Rails 4?
I have Agent and Brand in my Rails 4 app (an Agent has many :brands), and each one have a :subdomain field.
So I want to have:
- agentsubdomain.domain.com (should redirect to 'agents#show')
- ...
0
votes
2answers
13 views
How can I specify attributes to use in update_attributes in ROR3?
What I'm trying to achieve is to update only accessible attributes in my Order model passing a current_user object like this:
order.update_attributes(current_user.attributes.ONLY(:name, :surname, ...
0
votes
1answer
35 views
Rails reuse existing controller
There is a PartsController in my webapp and it works wonderfully well. It sends the right data to view so the view can render charts/stats/data etc. it and everything is full working order.
Now I've ...
0
votes
1answer
12 views
Rails server command generates another folder in project's folder with default folders and files
![Here is the screenshot of what rails server command is doing, instead of setting rails server... ][1]
Please see this what's happening and try to help me... [1]: http://i.stack.imgur.com/QSh21.png
...
0
votes
2answers
33 views
Change Root in ActiveAdmin
right now my active_admin gem in Rails has a default url of
www.home.com/admin
however the active admin resides in
www.home.com/group/admin
How can I make it so that every link in active admin ...
0
votes
1answer
29 views
rails adding tags to controller
I am implementing a basic tagging feature to my app. New to rails.
I have a listings model and I am working in the listings_controller # index. When the user goes to the listing page and sets the ...
0
votes
1answer
13 views
How can I set up reserved word for particular column in validation?
I have a model called Community and it has a column called name
I use this name in sub-domain.
For example, when a user access to http://rockstar.test-sample.com, it show the same content as ...
-1
votes
1answer
26 views
Are we supposed to use SQL command instead of using ActiveRcord?
I read an article saying that, for better performance, find_by_sql(xxxxxxxxx) should be used in place of find_by_name('John').
Is this true?
What is the difference between these two patterns?
If you ...