I'm using the Google Maps Javascript API so that I can have someone put a marker on a map and then get the latitude and longitude from that to submit as part of a form. I know how to get the data from the Maps api just fine, but I can't figure out how to submit the javascript variables that I have to the rails form?
An event is called e...
I would like to use the jQuery ajax method $.get to access a restful route in rails. Something like this (keep in mind this is done in a haml template where I can use string interpolation):
$(function(){
$(':radio').change(function(){
$.get("#{edit_steps_path(N)}");
}
});
In the snippet above #{steps_path(N)} interpolates to...
I haven't been able to find documentation that talk about how create.js.erb and destroy.js.erb fit in a Rails 3 app.
What is the logic behind these types of Javascript files in the app > controllers? How and when are they accessed?
...
I am trying to make a link to create a new nested resource in my Rails 3 application, but I can't figure it out. What is the syntax to link to a new nested resource
Solution:
Make sure you have your resources properly nested in your routes file.
resources :books do
resources :chapters
end
Then in your view script you can call it l...
I've been trying Time.parse() and Date.parse(), but can't see to figure it out.
I need to convert a date in the form "2007-12-31 23:59:59" to a UNIX timestamp. Something like PHP's strtotime() function would be perfect.
...
I am newbie to Ruby on Rails
This is what happened
I got a hosting from bluehost which supports RoR.
I download a Rack-based open-source web font server.
I copied that to my hosting domain.
I tried to startup that server using rackup filename.ru, but rackup is not avaliable... what 2 do now
How to start this server.
...
My current project is in rails 2.3.5 which uses restful authentication. I am moving this app to rails 3.. I want to know about the compatibility of authentication plugins with rails 3.
Can i use authlogic with rails 3 ? Is it reliable ?
what other options do I have for a very simple user authentication to work with rails 3 ?
thanks
...
I have a Byte Array field being returned to me by the database, and in the view, I need to somehow output that as an image. How would I do that in Rails?
Many thanks,
M
...
What steps should you use when in a need to write unit tests for STI associations. I am completely confused. Please provide some suggestions or links to some tutorials.
Thanks in advance
...
Hello, Ive got weird problem
My system is Snow Leopard (10.6.4) - I can't make pull from my RubyMine but I can make commit and push. The best thing is that when I run terminal and type "git pull" it works fine.
In ruby mine console there are some errors:
/usr/local/git/libexec/git-core/git-sh-setup: line 71: basename: command not foun...
Hi,
Did you get any way to have different database session for different user session??
If yes please tell me how to do that.
Thanks
Nitin
...
Hi,
This is currently the setup I have:
<input id="demographics_questionary_gender_male" name="demographics_questionary[gender]" type="radio" value="Male"> Male
<input id="demographics_questionary_gender_gender" name="demographics_questionary[gender]" type="radio" value="Female"> Female
<input id="demographics_questionary_gender_male" ...
Lets say I've Comment class that is polymorphic and I use it in many places within a system.
class Comment < ActiveRecord::Base
belongs_to :commentable, :polymorphic => true
attr_accessible :content
end
And there is this one place in which I would like to apply validation on Comment's content length. How should I approach this prob...
Say I want something like this in Rails:
class Proposal < ActiveRecord::Base
def interest_level
self.yes_votes.count - self.no_votes.count
end
private
def yes_votes
self.votes.where(:vote => true)
end
def no_votes
self.votes.where(:vote => false)
end
end
What have I basically done w...
Hi guys,
I'm building multi-tenant application.
All data isolation is done by TenantID column in each table.
What is the best way to automatically handle multi-tenancy for all tenant models.
Example:
Contacts.new({.....}) should automatically add :tenant => curret_user.tenant
Contacts.where({....}) should also add :tenant => curret_...
Hi guys,
Have somebody tried to rewrite CanCan ActiverRecordAddtions for
Mongoid http://github.com/ryanb/cancan/blob/master/lib/cancan/active_record_additions.rb
Regards,
Alexey Zakharov
...
hi
i am using jquery.jcarousel.js,
and
iam coming across the error- jCarousel: No width/height set for items. This will cause an infinite loop. Aborting...
please guide me how i can fix it
...
I am having performance issue in my application I want to use memcache I am using ruby version 1.8.6. Can anyone suggest me best way out. I want something similar to cache-money or any wayout using 1.8.6 I can use cache-money
...
In rails forms built with form_for, all of the fields called on the form object f are wrapped in an error div if they have caused a validation failure and the form page is re-rendered.
However, if i have a form that has hand-built fields, instead of fields called on the form object f, they don't get this. Is there a way that i can trig...
This seems to be an inconsistency between has_many and has_one.
The has_many association allows you to specify an after_add callback that is called after an object has been added to the collection.
class Person
has_many :parents, :after_add => { puts "Added new parent" } # allowed
has_one :car, :after_add => { puts "Added car" } #...