Assume, we have a model, let's call it Articles. There, we have two columns, min and max. The rule is: min can't be greater or equal to max. How do you resolve this custom type of validation? Any ideas?
Going further, let's assume that we have columns character and made_of. Task is to create a validation which is gonna help to avoid a s...
I am trying to build a rails app that's basically just a text-editor (with some additional features I can't find anywhere else - which is why I'm building it)
One of the core features is live concurrent editing, or real-time collaborative editing (whatever you want to call it).
So far I have set up the site with a plugin called Juggern...
This is killing me. In both IE7 and 8, using jqModal, the screen flashes black before the modal content is loaded. I've set up a test app to show you what's happening. I've taken jqModal EXACTLY from the site, no changes whatsoever, no external css that could be affecting my app. It works perfectly in every other browser (including IE...
if you haven't guessed by my other questions I'm building a soccer based apps and using data from different websites/feeds/api's but different websites carry team names either full names, abbreviated or slang names.
examples would be-
Manchester united- Man united- Man utd
Tottenham Hotspurs- Spurs, Tottenham Hotspurs FC
The main app...
I have a Rails app with a "Route" resource, and a "Route" controller (not to be confused w/ Rails routes). I've set it up so that the site admins (and only the admins) can manage the "Route" resource through the "Route" controller, while regular users manage their routes with a "Myroute" controller. I want both controllers to utilize R...
Is there a way getting all countries, states,cities zipcodes/ in one single database.
I have been looking all over.
I discovered geonames.org, which has I guess all of the content. But there is no way to fetch that data directly.
I am using rails. If there any helpers or Plugins, it'd be great. It would be awesome if there is a comple...
I have a form that contains the data to create a Product object. The Product has a relationship with an Image like so:
has_one :image
In my view I have a file input like so:
<%= f.file_field :image_file %>
In my Product model I have:
def image_file=(input_data)
self.image = Image.new({:image_file => input_data})
end
The ...
We just launched and are looking to better understand where the users who are converting to registered users are actually coming from. We can see our traffic sources and referrals via Google Analytics and our other web statistics programs, but in volume, it's difficult to tie these specifically to which users in our database have conver...
Hi,
I have an rails app which redirects wrong urls to "/".
I made 404.html file and it has the following code.
<script type="text/javascript">
<!--
window.location = "http://www.mydomain.com/"
//-->
</script>
It works well in Firefox but IE doesn't redirect.
IE draws its own "The webpage cannot be found." page.
I checked log ...
How would you test multi user interaction with Cucumber/webrat?
Meaning that there must be more than one user logged in. Good example would be simple chat application, where I want to send message from one user to another and check if the other user received the message.
I'd like to test at integration level, without any stubbing or m...
I have an index of users where I display the user name, location of user and a field called categories, which can range from zero to many items. I'm having trouble getting the categories to display properly. Here are my details:
User
has_many :user_categories
has_many :categories, :through => :user_categories
Categories
has_many ...
I'm working on a Rails app, where I'm using page caching to store static html output. The caching works fine. I'm having trouble expiring the caches, though.
I believe my problem is, in part, because I'm not expiring the cache from my controller. All of the actions necessary for this are being handled within the model. This seems like i...
In my controller, a function runs a shell command. I'm having a hard time to locate the script in the commad. For example, in my controller I have this:
def find_usage
command = 'ruby usage.rb'
#{command}
end
My question is where to put that usage.rb file and how to reference it without hard code the entire path. It works when I...
I am working on a Rails app that displays a sports schedule (in a basic table). Each game/event is a db table row. The customer wants all the events to display in chronological order but to also display the time in the event's local timezone.
How can I add a timezone selector to the New action? So that when the customer enters events...
Hello,
I'm using Rails 2.3.4/Ruby 1.9.1 for my application. In the view I have this to show error messages:
<%= content_tag('div', flash[:notice], :class => 'flash notice') if flash[:notice] %>
it works fine if I assign it manually from the controller such as:
flash[:notice] = "User Name can only contain letters, number - or _"
Bu...
I'll like an opinion on the following issue. I'm currently developing an application in which accounts are managed by subdomains (foo.example.com,bar.example.com...). I was wondering which is the best way to enable users to navigate through different accounts. The options I have in mind are:
1) Make each user leave their account subdoma...
I am learning Cucumber and Webrat with Rails and would like some advice on the best way to test an "edit" form. When I browse to a user's profile I am presented with an edit form with the user's information pre-populated in the form fields. I would like to be able to test that the fields do in fact contain the information I expect. Here'...
In production, I maintain two sites - beta and release. Each points to a different directory via a soft link (e.g.)
beta_public_html -> /home/scott/myapp/trunk/public
public_html -> /home/scott/myapp/branches/1.2.3/public
I'm a longtime svn user, moving to git. I'm used to deploying via svn update and changing the soft link on a ...
I have completed chapter 6 Task A: Product Maintenance but after completing the chapter am still not be able to see the pictures i have used while making product listing. It is just showing me only the name of that picture instead of real picture.
can anyone please help me?
...
Ok, i'm working on views for my little project. Every day I make things like this:
<li <%= 'class="'+item.status.caption+'"' if %w{ sold, absent }.include?(item.status.caption) %> >
Recently, I found a proper String method in Ruby API, called quote.
I wrote this:
<li <%= 'class='+item.status.caption.quote if %w{ sold, absent }.inclu...