Greetings,
I have an application which contains a calendar as alternative index view for Courses (Project has_many Courses). There I have two arrows for navigating to the next/previous month, it works via AJAX. Now, that's my action for updating the calendar:
def update_calendar
@project = Project.find params[:id]
@date = Date.pars...
I have two classes, Task and Subtask. Subtask varies very little from Task except for one important thing, it must include a different module.
The included modules, subtask_module and task_module, both have the same methods and aliases for my purposes, but internally they function a little differently once the included module extends it...
Hello ,
I want to write a regular expression for First name validation .
The regular expression should include all alphabets (latin/french/german characters etc.). However I want to exclude numbers from it and also allow -.
So basically it is \w (minus) numbers (plus) -.
Please help.
...
hi all
I have a has_many_polymorphs relationship that involves the following
classes:
class DigilearningModule < ActiveRecord::Base
has_many_polymorphs :members,
:from => [:digilearning_titles, :lesson_categories,
:lesson_category_groups],
:through => :digilearning_module_memberships,
:dependent => :destroy,
:uniq => true...
I need to store objects in session DB but authlogic plugin by default store session in cookie. It does not let access session DB table. I could not figure out how to change session store in authlogic plugin.
...
Im using 2 different sets of views for 2 different user's roles.
Im using register_alias :
Mime::Type.register_alias "text/html", :basic
in the controller:
class SomeController < ApplicationController
def index
# …
respond_to do |format|
format.html # index.html.erb (advance)
format.basic # index.basic.erb
...
I have some checkboxes like so in a form:
<%= check_box_tag "marked[#{relative_filepath}]", 1, false %>
Which produces:
<input type="checkbox" value="1" style="display: none;" name="marked[/blah]" id="marked__blah">
Now supposedly, I should there should be a hash in params[:marked], but this is nil.
What am I doing wrong?
...
Hi folks, i would like to trigger an event sometime in the future based on an event that is currently happening. I do not expect the volume to be too high, so i care a lot more about simplicity than performance.
For example:
event A happens. i need event B to happen a day later (not time critical)
system stores a record of event in d...
I want to create a web app similar to http://www.pastebin.com/ in Ruby on Rails. pastebin.com uses a random string to identify an item. Ruby on Rails uses an auto-incrementing number. How can I make Ruby on Rails also use these random strings as IDs for items, instead of auto-incrementing numbers?
Thanks
...
It seems rails 3 doesn't have rake gems:unpack, what we should use instead?
...
So... I know about the :locals => { :var1 => @rawr, :var2 => @hello } syntax for partials
but is there a way for me to pass both @rawr and @hello to the partial, so that i don't need to use var1 and var2?
...
Hi...
I've been trying to setup autotest with rails 3 beta4 but I getting a "-bash: autotest: command not found" -- any ideas?
I installed it by putting the gem in my gemfile and then doing a bundle install..
...
I'm trying to build a form for an "Incident" that allows users to add notes (text fields) to it dynamically with some javascript. So when they click an "Add Note" button in the form, a text field pops up and they can add a note. If they click it again, another field will show up. So far this works fine when creating a new incident, bu...
I have a Request model, which has a requesteeID field. When I'm running the site on my local computer, I can run this line of code:
a = Request.find_all_by_requesteeID(current_user.id)
and it works fine (note: I can't do current_user.requests because the models are joined by another field, requesterID). But when I run it on Heroku, it...
I would like to be able to execute some code after having send the response to finalize things which takes time but the user doesn't need to wait for.
Is there a way to add a callback or hook to do this ?
If I use after_filter or (around_filter) its called after the controller but still before the response is sent. I' m considering usi...
I have a series of divs, and each one has a delete link. Each one also has a currently hidden spinner image. Idea is that when the delete link is pressed (and the object in the div is being deleted), the spinner is displayed. Once the AJAX call to delete the object is done, then the div item is removed from the series.
My problem here i...
I've been search around for a good gem/plug-in to allow intuitive user input of a date(i.e. select a date from a pop-up calendar).
calendardateselect looks really good, but it's no longer in active development, and no longer installs correctly.
I found a few others, but they were all quite stale. What are Stack Overflow users using fo...
Hello, all my fellow coders!
I've got a problem ohh chok!.. :P
Now my problem i that i'm trying to make a design for a bigger site, it's going good. Until i should make the content/news slider. It should take data from multiple tables and returning to the application.html.erb.
So it is take reviews and announcements just the latest 5 ...
I am pretty new to using rspec and am trying to write my tests for my controllers. I have this controller (I am using mocha for stubbing):
class CardsController < ApplicationController
before_filter :require_user
def show
@cardset = current_user.cardsets.find_by_id(params[:cardset_id])
if @cardset.nil?
flash[:notice]...
Is it possible to use rescue_from in an ActiveRecord Model? This doesn't seem to work:
class Book < ActiveRecord::Base
include ActiveSupport::Rescuable
rescue_from ActiveRecord::StatementInvalid do |exception|
# something here
end
The code executes, but the StatementInvalid error is still raised
Any ideas?
...