In my Rails app I've created a set of checkboxes as follows:
<div class="form_row">
<label for="features[]">Features:</label>
<% ['scenarios', 'news', 'role_profiles', 'private_messages', 'chatrooms', 'forums', 'polls'].each do |feature| %>
<br><%= check_box_tag 'features[]', feature, (@features || {}).include?(feature) %...
Where is the error in this I can't see it:
news = News.find(:all, :conditions => [":simulation_id => session[:sim_id] AND :created_at > session[:last_login]"])
...
Is there a plugin for this or a gem that I can use. I was thinking about just writing it to a table when a view was called in the controller. Is this the best way? I see stackoverflow has this functionality how do they do it?
...
I've written a rails app that's been running fine for a while without a database. Now, I'm dropping the registration database into the mix. It's not working in production. Everything works fine, of course, on my Mac.
Here's the production environment:
- Ubuntu Hardy
- Phusion Passenger
- Rails 2.3.2
MySQL on the machine is running fin...
I'd like to have some Cucumber/webrat integration tests of my search features that use thinking_sphinx & sphinx but the problem is that the data is loaded and then rolled back in a transaction during a typical cucumber test so there is no way for thinking_sphinx to index it. Alternatively, is there a way to turn transactions off for jus...
Hello, I have a has_many relationship between two entities, Feeds and Posts. I also have specific types of posts, Videos and Photos. This is structured in the database using single table inheritance.
Right now I have my Feed model specifying a has_many relationship between Feeds and Posts (including the subtypes)
class Feed < ActiveRec...
Hi All,
I'm using attachment_fu in a rails application to handle file uploads, and i want to save them in a directory in the root of the application called attachments. however, I cannot seem to make this plugin save a file in any other directory than public. Can anyone tell me how to do this?
thx
-C
...
I have a simple has_one/belongs_to relationship between two models.
This is a new association in my application so there are many records that do not yet have the associated record created.
Throughout my application I'm assuming the model has the association and I'm accessing its attributes and methods. However, because the associatio...
I'm going through the railscast no 73 (http://railscasts.com/episodes/73-complex-forms-part-1), where Ryan Bates explains how to use multiple models in a single form. He creates a project object, along with its tasks, in a single form (A simple app, where you create a project and its associated tasks)
It works well, but I'm not sure ho...
I was looking at a SO member's open source project. It was a web framework written in C++.
Now you are all probably ready to respond about how C++ is a horrible language to do websites in, and that in websites, the bottleneck is in the database.
But... I read this post:
http://art-blog.no-ip.info/cppcms/blog/post/42
and in there he m...
In my rails project I have the following code
auto_link( h( wrap_long_string(post.text,50) )).gsub(/\n/,"<br />")
wrap_long_string is defined as:
def wrap_long_string(txt,col = 20)
txt.gsub(/(.{1,#{col}})( +|$\n?)|(.{1,#{col}})/,
"\\1\\3\n")
end
This code is meant to display user entered text while preventing users f...
I have a system I'm building that seems to call for some complex rules and rather than have a mess of rules through out the system. I was looking to centralize the process. (Which may not be the smartest idea I've had)
My most (perhaps least) brilliant idea was to use a seperate class to check any objects before being saved to the datab...
I am trying to create clean urls in rails. I have installed PermalinkFu and I can generate the links just fine. What I would like to do is keep my RESTful resource. Is there a way I can overload:
map.resources :location
to return :permalink variable instead of :id?
Similar to how I can create:
map.connect 'location/:permalink' :c...
I am a rails noob. I am having a problem conceptualizing how assets work in an authenticated system.
All of the tutorials I've seen so far talk about putting your swfs in the public folder and embedding them in your view. However, the swf I'm using is a flex gui that should only be used by users logged-in through restful-authentication....
I'd like to go into Django with Python, but it seems that some hosting companies like DreamHost, Netfirms, they both offer Ruby on Rails in the basic hosting package, but not Django. They only list Python, but not the framework. So does that mean if I use Django, I will need to look for companies that support Django, or can I simply ad...
What's the best way to implement an interface that looks like this in rails?
Currently I'm using Searchlogic, and it's a tad painful. Problems include:
Making sure certain operations remain orthogonal -- for example, if you select "Short Posts" and then search, your search results should be restricted to short posts.
Making sure the...
Hey,
Before my form initiates an AJAX request, I want to call a function.
I see that for link_ to_remote there is the handy :before option... "Called before request is initiated."
here is my source:
<% form_remote_for(@news, :url => {:action => 'create'}) do |f| %>
Before the request is initiated, I want to call myFunction()
Thank...
I would like to use the group_by method, but instead of using a column in the database:
@posts.group_by(&:date)
I want to have something like:
@posts.group_by(&:author)
Where post belongs_to author.
I'm just not sure of the syntax?
...
I want to explicitly pass a boolean false to params[:closed] and I've got something like this:
= link_to 'appointments', appointments_path(:closed => false)
But this is not working as rails is treating a false boolean as I don't want anything set for this params, is there any way to get around this?
update: the false I'm passing in i...
I've been banging my head against this one for a couple days now:
I've got a RoR app using AuthenticatedSystem to require authentication for some of the resources. A before_filter checks to see if the user has logged in. If not, it grabs the request.request_uri and puts it in a session variable (session[:return_to]), then sends the user...