As a new comer to writing front-end views with Rails, I'm a bit confused as to when I should be using rjs templates versus when I should be writing my own JavaScript to handle events/DHTML. Is there some rules you avid Rails developers follow for when something is too complex or not possible with RJS and you just write the JavaScript you...
I am using the open_id_authentication plugin for login purpose. I am able to integrate the plugin correctly and it works well. I would like to retrieve additional values like the nickname and email of the user, which I am not able to retrieve. I am using the following code but the registration fields are empty . Am I doing something corr...
So this is a newbie rails design question. Lets say I want some of my common functionality to be sitting in a set of helper classes (either as class methods or instance methods).
And I want to use these helper objects inside controller (not view) or even may be a model. can I do that? how? Does it have to be a module or class or can be ...
I am working with a database that is already in place and used by other applications.
The people who designed the database did not use pluralized table names, so DataMapper chooses the wrong table name when following associations.
For instance:
class Foo
has n :components # => the table name here should be COMPONENT, but datamapper ...
I have an array that I want to iterate over and delete some of the elements. This doesn't work:
a = [1, 2, 3, 4, 5]
a.each do |x|
next if x < 3
a.delete x
# do something with x
end
a #=> [1, 2, 4]
I want a to be [1, 2]. How can I get around this?
...
Let's say I have two models Post and Category:
class Post < ActiveRecord::Base
belongs_to :category
end
class Category < ActiveRecord::Base
has_many :posts
end
Is there a method that will allow me to do something like
posts = Post.find(:all)
p = Array.new
p[1] = posts.with_category_id(1)
p[2] = posts.with_category_id(2)
p[3] =...
Hi
How can I add multiple objects in a find condition?
I created a table for comment but I want to display comments posted by a user and
His or her friends.
I got the find method to return a list of comments by a users friends but I cannot get the
Find method to include the user as well.
For example
User = profile.find(1)
Comment.fi...
Hi, I'm new to ruby however it isn't really that drastic of a change coming from perl, anyways 've written a simple script to convert my gobs of perl Data::Dumper output into yaml configs, my problem is I'm using eval to accomplish this and seeing as I may like others to use this script one day I would like to eliminate eval for somethin...
Can you guys please recommend few textmate bundles that would be helpful while developing ruby on rails applications
...
I want to filter the content in a simile Timeline display on some field other than description.Is it possible?
...
Is there an easy way of automating clicking on a certain button on a website?
I'm trying to help someone in my company out, the guy basically stares a booking page the entire day, having to click on a single button to refresh the page. If new booking slots becomes available, then it will only be shown on the page on the page refreshes, ...
I have two types of classes:
BaseUser < ActiveRecord::Base
and
User < BaseUser
which acts_as_authentic using Authlogic's authentication system. This inheritance is implemented using Single Table Inheritance
If a new user registers, I register him as a User. However, if I already have a BaseUser with the same email, I'd like to ...
Is there a clean way to extract the version string from a .gemspec file? (The gem is not yet installed)
e.g. somethingcool.gemspec is
Gem::Specification.new do |s|
s.name = "somethingcool"
s.version = "1.2.3"
... etc ...
end
I want to extract "1.2.3".
I could grep it out but there must be a better way.
...
I'm trying to use a yaml config file as a very simple flat file db for a small rails app. The app has a single user, so I just need a way to store a username and password. The only thing is that I'd like to be able to edit the username and password while still inside the app and not require an app restart (so I can't load the YAML file...
I am using simile Timeline to display events in event table from my database, where i am loading data using xml,
<data>
<event eventType="Happy" title="My Birthday" end="2010-08-15" start="2010-08-15" isDuration="false">Party time </event>
</data>
This would display title,description,start date and end date on simile, but I also want...
Is there a definitive specification for Ruby, akin to the Java Language Specification for Java. Googling ruby language specification provides http://ruby-std.netlab.jp/ as a result, but the site is down and i am not sure whether it is current
...
How to write a program to test another program/script?
I need to test a ruby script that is an echo server; how should I write a program to validate the correct working of the echo server script ?
...
Running this code:
module A
def self.included(klass)
klass.send(:cattr_accessor, :my_name)
end
def set_my_name_var
@@my_name = 'A' # does NOT work as expected
end
def set_my_name_attr
self.class.my_name = 'A' # works as expected
end
end
class B
include A
cattr_accessor :my_other_name
def set_my_other_...
I am Amit. i am new to Rails. Please forgive me if ask any stupid
questions.
I have gone through this article. I am also suffering with the same
problem.
my website URL like this: locahost:3000/users/edit/30
I don't want to show the controller:users and action: edit.
I want to Re-Write (rewrite) the URL or i want to maintain the URL...
I want to use the assertions and put valuidations in my ruby code (e.g: checking if a zip file is created, label is present, message in the text area, etc). I have put a few assert statements like assert @selenium.is_text_present(textMessage), but they don't work.
Please let me know if any ruby gem for assertions is to be installed.
...