Hello
I am trying to DRY up some code by moving some logic into the FormBuilder. After reading the documentation about how to select and alternative form builder the logical solution for me seemed to be something like this.
In the view
<% form_for @event, :builder => TestFormBuilder do |f| %>
<%= f.test %>
<%= f.submit 'Updat...
Hi All,
I want regular expression in ruby on rails which remove all the html tags and its content from the given text.
For example if my text is :-INPUT :-
<span id="span_is"><br><br><u><i>Hi</i></u></span>
then it should display only OUTPUT should be as follows:-
Hi
in short i want regular expression or a function which remove...
Hi Experts, I would like to ask your guidance on how to authenticate using email add/ the basic log-in while having also a twitter log-in, twitter authentication works fine but if having an alternative log-in like using basic sign-up and email log-in part wont work....
any ideas please...?
...
Hi, I have the following models:
class User < ActiveRecord::Base
has_many :results, :dependent => :destroy
has_many :participants, :dependent => :destroy
has_many :courses, :through => :participants
end
class Course < ActiveRecord::Base
has_many :tests, :dependent => :destroy
has_many :participants, :dependent => :d...
Hello All,
I am trying to get hold of rails counter cache feature but not able to grasp it completely.
Let's say that We have 3 models
A B C
A belongs to B or C depending upon a field key_type and key_id. key_type tells whether A belongs to B or C so if key_type="B" then the record belongs to B otherwise it belongs to C.
In my mode...
You'll have to bear with me as I'm not a Ruby dev, but have inherited a Ruby system.
I need to deploy some changes to the app from my repository to the server. I've been instructed to run cap deploy and told that that script will get the latest code from my repository and deploy it to the server.
My problem is that I have to VPN to ...
I have a Rails application using with an authentication system using Restful Authentication without any modification.
Users have reported finding themselves logged in as the wrong user. In at least one case it was on their very first page view, never having logged in before.
Is it possible their session ids are getting mixed up? Would ...
How can I use radio buttons in a form in Hobo Rails? I want a gender field with two options "Male" and "Female". If I use the default enum_string type it creates drop down select instead of radio buttons.
...
Hi all!
I need to know the ID of the current user in a model:
def after_save
desc, points=nil, nil
if answer_index == daily_question.correct_answer_index
desc = I18n.t('daily_question.point_log.description.correct')
points=daily_question.points
else
desc = I18n.t('daily_question.point_log.description.incorrect')
...
I am looking for a drag and drop components implementation for a website similar to http://www.netvibes.com. So the positions of the components should be saved in database. If any one can help me with any javascript or rails tutorial implementation or guidance for this, that will help a lot.
...
In this video (10 sec) you can see that the nested attribute is only updated if it's parent model is changed.
Using rails 3.0.0.beta and full project is on github.
Summary of models and form:
class Project < ActiveRecord::Base
has_many :tasks
accepts_nested_attributes_for :tasks
end
class Task < ActiveRecord::Base
belongs_to :p...
Hello,
I use Declarative Authorization and Authlogic and now wants to create a dashboard for the administration. About ActiveScaffold will be an overview of the different controllers are shown.
However, I have the problem that I can admin no "admin rights" to the subfolders
app/controllers/admin/admin_controller. How can I do that?
C...
"select * from users, awards where (users.id = awards.user_id) and awards.trophy_id not in (select awards.trophy_id from awards where awards.trophy_id = #{trophy.id})"
...
I'm struggling to find a tag selection UI for a rails app. Ideally it would be something like the selection here on Stackoverflow, or on Delicious or Digg.
I want users to be able to select multiple tags with a single click. We're already using jQuery, so it makes sense to use something that takes advantage of that. I've used the sel...
So I am trying to get the cancan gem to work with my rails 3 app and I've hit a problem.
I tried to copy the code that Ryan Bates (the creator of the gem) used in his screen cast, but I get an error saying that roles_mask is not a method. I figure that the _mask method was removed from Ruby/Rails at some point, and I'm now wondering wh...
hi
I know about the built-in I18n in Rails, but how can I select a database field per locale?
My model structure is something like this:
title #default (englisch)
title_de #(german)
title_it #(italian)
In my template I want to be able to write only
<%= @model.title %>
and should get the value in the right language.
Is there ...
Is it possible to exclude specific files (*.ai, *.psd) when pushing to certain repositories with Git?
My need comes from trying to use Git for both version control and deployment to Heroku. If I include my graphic assets in the deploy, the slug size is larger than desired. However, I do need to include all project files in my main gith...
I have a number of models that store words as a string with each words separated by a space. I have defined model methods to delete and add words to the string and the size or number of words is updated each time accordingly. There is an error somewhere because the size sometimes comes out to be negative. I'm wondering, what is the be...
Can't find any tutorial for creating a simple questionnaire system on RoR (without using Finite State Machines).
I think the Model is simple:
Quizzes (have many Questions)
Questions (belong to Quizzes, have many Choices, have one Answer)
Choices (belong to Questions)
Responses (belong to Users, belong to Questions)
Users (have many ...
I'm not sure of the best structure for a particular situation in Rails. We have several types of workshops. The administration of the workshops is the same regardless of workshop type, so the data for the workshops is in a single model. We collect feedback from participants about the workshops, and the questionnaire is different for each...