I'm working on implementing javascript functionality in my rails 3 app. Now that rjs is supposedly unobtrusive (I honestly don't know a lot about rjs), is it still "evil"?
It seems to me the downside may be a lack of testability, but partial page updates via rjs seem to be easier than jumping through the rails hurdles to make ajax requ...
I don't know how to make a link_to because I'dont have a nouveau_message_path in rake routes
rake routes :
GET /nouveau_message/.:id {:action=>"nouveau_message", :controller=>"messages"}
routes.rb :
controller :messages do
get 'nouveau_message/.:id' => :nouveau_message
end
What is the best way to make a link_t...
In my model, I have a departure_date and a return_date.
I am using a text_field instead of the date_select so that I can use the JQuery datepicker.
My app is based in the US for now but I do hope to get international members.
So basically this is what is happening. The user (US) types in a date such as 04/01/2010 (April 1st).
Of co...
Hi!
I've got some form for user registration and want to localize it via locales yml files. Especially errors from validations.
For example, locale file:
tr:
activerecord:
errors:
models:
user:
attributes:
name:
blank: "can't be blank"
it will return: name can't be blank in er...
Is there a way to start a Rails 3 development server (rails server) that is not bound to a specific IP address? I'd like for others working on a project with me to be able to use the application from remote locations.
...
Hello,
I would like to create a login field everywhere on the top of my page, so I've add a :
in application.html.erb :
<%= render :partial => 'sessions/new' %>
in .../views/sessions/_new.html.erb
<%= form_tag do %>
<div>
<label for="name">Email :</label>
<%= text_field_tag :name, params[:name] %>
<label for="password...
I have these tables and relationships:
user has_many projects
project has_many tasks
task has_many actions
I would like to build a scope that allows me to select all of the current users actions, regardless of what project or task they belong to.
Thanks
...
I have recently been getting my feet wet in MongoDB using Mongoid w/ Rails 3, but I'm now interested in learning the low level MongoDB features using only the Ruby driver, and trying some map/reduce that would not be possible through Mongoid (afaik)
I'm not entirely sure where in Rails I should be setting up the db connections etc, and ...
I have this routes:
resources :tags do
resources :comments
end
so the :create action for the comments has the following form
tag_comments POST /tags/:tag_id/comments(.:format)
how can i change the paramenter name from :tag_id to :commentable_id?
...
There are two models Post and Comment. I should get all posts, which have no comments with specific tag. How can I do this using new Rails 3 features such relational algebra (arel).
SQL-solution should be something like this:
SELECT `posts`.* FROM `posts` LEFT OUTER JOIN `comments` ON `posts`.`id` = `comments`.`post_id`
WHERE...
I am trying to use the Sunlight API gem with a Rails project. I have installed the gem and can successfully use it from irb.
However, when I put the require statement (require 'sunlight') in sunlight.rb in config/initializers, I get the following error:
/opt/local/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta3/lib/active_support/depe...
Hi,
I have the following routes:
resources :categories do
resources :articles
end
And the following views:
# edit.erb and new.erb files:
<%= render :partial => 'form' %>
# top of _form.html.erb file:
<%= form_for category_article_path(@article.category, @article) do |f| %>
But I have some troubles with the given path. I work w...
In my Rails app, I loop through an array to create a list of conditions that must be joined by OR. Below is the basic flow of how I currently do so.
conditions = nil
set.each do |value|
condition = value.to_condition
conditions = conditions ? conditions.or(condition) : condition
end
Obviously, it's not beautiful, but I still don't...
I am using ActiveRecord in Rails 3 to pull data from two different tables in two different databases. These databases can not join on each other, but I have the need to do a simple join after-the-fact. I would like to preserve the relation so that I can chain it down the line.
here is a simplified version of what I am doing
browsers ...
In rails 2 you can use the :any option to define a custom route that responds to any request method e.g.
map.resources :items, :member => {:erase => :any}
rails 3 doesn't seem to support the :any option
resources :items do
get :erase, :on => :member # works
any :erase, :on => :member # doesn't work
end
does anyone know if this ...
Hello,
I would like to write some unit test with a logged user using Authlogic. To start right, I used some code hosted in http://github.com/binarylogic/authlogic_example. But I get an error after rake test, because of "test_helper.rb" and the following class:
class ActionController::TestCase
setup :activate_authlogic
end
Here is...
I like that Rails 3 is so easy to install: gem install rails --pre, and all of the dependencies are automatically installed for you. But, what about uninstalling it? If I just do gem uninstall rails, I still have
actionmailer (3.0.0.beta3)
actionpack (3.0.0.beta3)
activemodel (3.0.0.beta3)
activerecord (3.0.0.beta3)
activeresource (3.0....
In my website toolbar's I would like to display the number of unread messages in a red circle,
So I think the best way is to create a method in ApplicationController named update_notification :
def update_notification
@notification = 42
# 42 is just for test
end
and in application.html.erb, I display :
<%= render :par...
A while back I wrote this blog post (http://rywalker.com/chaos-2010) which didn't get any responses - my blog doesn't get a lot of traffic ;) So I want to try re-asking the same question here and maybe get some response.
We have the following systems (and more) that we push/pull data from one app to another:
Hosted CRM (InsideSales.co...
I'm using Rails 3 beta 4 and trying to include ActionController::UrlWriter in my model, which is the correct way to go about it as far as i can tell, but i get "Uninitialized Constant ActionController::UrlWriter".
Any idea why that would be? Did it move in rails 3?
...