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.
0
votes
3answers
20 views
Why does this return no method error when trying ordering?
I'm using the gem called acts_as_follower(https://github.com/tcocca/acts_as_follower)
Here, I'm trying to fetch all the users who are following current_user.
then I want them ordered by the column ...
0
votes
2answers
12 views
abstract away same methods in 2 models for use in a rails rake task
I have a rake task that calls the methods of a model in which i have defined some methods. However, I need to also run the rake task in a different database with the clone table. So I ended up ...
0
votes
1answer
12 views
How should I handle edit and update action when I use Form Object?
I have following form object to managing complicated nested form.
Form
= simple_form_for(@profile_form, :url => profiles_path) do |f|
...
Routes
resources :profiles
Controller
class ...
0
votes
0answers
14 views
How to search for controllers in multiple directories?
I created a very simple plugin system in my Rails application. These plugins can bring along their own views and controllers in their subfolder.
Thus, when searching for controllers, I want Rails to ...
0
votes
1answer
15 views
Does Rails do automatic casting before validation?
I have some form and I pass params to the update_attributes. There is also some value, which is an integer (in a database), but in form it is a text, which I want to parse in before_validation.
...
0
votes
1answer
19 views
Why won't this be in order?
I'm using the gem called acts_as_follower(https://github.com/tcocca/acts_as_follower)
Then I have a column called last_active_at in users table(User model)
Here, I want to fetch all the users who ...
0
votes
0answers
26 views
Device logout when trying to update item only on firefox
I have a strange issue with my app:
When i try to update an item i'm signed out by device unexpectedly just after the PUT.
More strange this is only happening on Firefox and in production.
On all ...
1
vote
1answer
14 views
Spree Mail Method is not working?
In spree admin panel under configuration menu, I configured mail smtp, port and etc., after creating new mail method I press test mail button, I got following alert message "Testmail sent ...
0
votes
1answer
18 views
Ho to crawl right with Nokogiri
I hope you can help me. I am trying to crawl a website with 4500 links in it containing information. So the structure is like this:
Tier 1 (just different categories)
Tier 2 (Containing ...
0
votes
1answer
39 views
How to initialize varible only if it is set up in controller?
I have FormObject and Controller.
FormObject
class ProfileForm
def initialize(profile)
@profile = profile
@person = profile.person
end
def profile
@profile ||= Profile.new
end
...
0
votes
1answer
21 views
Rails' client-side-validation form_for error
I am using client validation rails gem and I got this error. Any idea.....
wrong number of arguments (3 for 2)
Extracted source (around line #1):
<%= form_for @user, :validate => true do |f| ...
0
votes
0answers
9 views
Mongoid: add some dynamic (non-DB) fields in Model before passing it to Controller
Let's say I have a Model Item which uses Mongoid
class Item
include Mongoid::Document
field :title, type: String
...
...
end
I want to add some dynamic fields to Item right in Model ...
0
votes
0answers
24 views
Custom link in an open graph story
I'm building a facebook app which uses open graph to publish stories. I can successfully publish the stories but what I want to do is to customize the link in the story(detailed in the given image).
...
0
votes
3answers
36 views
The best way to combine two active record queries
What difference between two approaches shown below and what is better:
user.photos & Photo.public
and
user.photos.where('photos.id IN (?)', Photo.public.select(:id))
Is there ...
0
votes
3answers
28 views
Is this way of calling object supposed to be bad practice when considering loading speed?
My way
controller pattern 1 (note: Here, it's calling all users!!)
@users = User.confirmed.joins(:profile)
view pattern 1 (note: Here, it only shows first 10 users but it show the number of all ...