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
0answers
6 views
Ruby On Rails searching database for word
I am new to rails. I am trying to search a database in MySQL where the term I am searching may be one word in the column string. For example if the cell was "this is a very lovely day" then I would ...
0
votes
1answer
12 views
Rails convert plain text to html before saving in database
We have a rails app and messages that are sent as json are in plain text:
{ "TextBody": "To confirm your subscription to 'Blah ads. Location: Blah. Category: buy and sell.', please click on the ...
0
votes
1answer
15 views
Rails redirecing with session variables
I have a landing page controller that looks like this ;
class LandingController < ApplicationController
def index
@user = current_user
@name = @user.name.titleize
...
0
votes
0answers
16 views
How does one alias a method that does not yet exist? (Ruby Decorator)
This is going to sound pretty crazy, but I'm trying to build a generic decoration-based system which will allow a decorated class to do all kinds of crazy stuff with attributes. The goal is to be ...
0
votes
2answers
21 views
Rails returns empty hash
Why would this hash return empty? It's in my document model:
def li_hash
li_hash = Hash.new do |share|
share.comment "#{self.remove_html(self.components.first.body[0..300])}..."
...
0
votes
1answer
19 views
Git default branch issue
I'm new to git and I'm working with another developer. I want whenever I do git pull or git push to only affect the development branch. I went to .git/config but I don't understand what is there. Any ...
0
votes
0answers
5 views
Creating a new user with credentials, then obtaining a token for that user with Doorkeeper in an API
I'm building an API, protected by Doorkeeper.
If I manually create the user (with password) in the backend, and then post the following to oauth/token, Doorkeeper successfully generates an access ...
0
votes
1answer
16 views
Override all queries to a given model in Rails 4
Is it possible in Rails to override all queries on a given model regardless of the association they are coming through. Example:
I have a Counties model that is referred by several models in my ...
0
votes
2answers
15 views
how does the object parameter with render work exactly
what does the following code do?
<%= form_for(@user) do |f| %>
<%= render 'shared/error_messages', object: f.object %>
....
<% end %>
It renders a partial name ...
0
votes
0answers
10 views
Rails: Any way to generate Active Admin views (add nested forms)?
Is there anyway to generate Active Admin's views? I know how to override them but I'd like to keep their basic layout but just add some nested forms.
0
votes
0answers
13 views
DB table friendship relationship options
I'm doing a database exercise and have been asked the question below:
DB Model:
Say you designed a friendship model
If user_a becomes friend with user_b, could you compare the advantages and ...
0
votes
0answers
7 views
Elasticsearch with Tire, how can I get global facets to take queries and other facets into account when reporting the count?
The problem can best be shown with a working example to get an idea of what I'm trying to do.
Example on Newegg's faceted search page...
Here's a link to just internal hard drives:
...
0
votes
2answers
15 views
Rails show action where `id` is not explicitly stated in params
In my app, I have a view that shows a number of products. If a product has an active "deal" on it, a link to that deal is given for that deal that links to the show action for that deal, as below.
...
0
votes
0answers
8 views
Rails and prawn: trim pages
Say I've got a three-page PDF and I want to trim the first page. I'm using prawn to manage the PDFs. How would be best to go about that? I think I've got the logic alright but I can't seem to ...
0
votes
2answers
48 views
Use self to refer to highest class
How do I use self to go up two classes? For example, I have the following code:
class Project < ActiveRecord::Base
class Current
self.state = true
end
end
I need self.state to ...