Hi,
I am working in Ruby on rails. I am trying to call APIS of my rails application using Jersey library.I am having 2 tables namely blogs (id,title,desc) and comments (id,commentdata,blog_id)..
I have written a function which retrieves the blog by giving its title.
All these working fine.
Now i am trying to fetch the comments also ...
Possible Duplicates:
i = true and false in Ruby is true?
What is the difference between Perl's ( or, and ) and ( ||, && ) short-circuit operators?
Ruby: difference between || and 'or'
Is || same as or in Rails?
Case A:
@year = params[:year] || Time.now.year
Events.all(:conditions => ['year = ?', @year])
will produce ...
I'm writing a webapp in Ruby on Rails 3. Rails 3 automatically escapes any potentially-bad strings, which is generally a good thing, but means if you assemble HTML yourself, you have to call html_safe on it.
I have a Card model, which has several text fields, the contents of which are not trusted (may contain evil HTML or script). I hav...
I have a rails 2.3.9 application that i'm migrating to rails 3.
As almost everyone, i'm having problem with rendering strings, specially JQUERY scripts that were inline. Before, that somebody tells me that in rails 3, it changed, i cannot rewrite all my scripts now. I will do it, it will be scheduled, but for now, i want to make it work...
Hi , I am new to rails.. I am having a line in the mailing queue.rb file as
subject ="Mail : Welcome to app"
I have added translation for Welcome to app as
str_welcome: "Welcome to app"
Now i am trying to replace Welcome to app in the file with the str_welcome
how to do that as i have another prefix ("Mail") also ..
...
Hi!
I use Ruby On Rails and devise gem.
I want redirect user after registration, but in devise i can redirect only after sign_in (http://github.com/plataformatec/devise/wiki/How-To:-Redirect-to-a-specific-page-on-successful-sign-in).
...
Beeing new to programming I'm trying to learn RoR using railstutorial.org and ran into a problem in chapter 1.4.1 (http://railstutorial.org/book#sec:1.4.1). Whentrying to add my SSH key the following happend:
Basti@Basti-PC ~
$ heroku keys:add
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load --
readline (...
I have this data and as you can see I have about 10 requests. A request has a venue, song, date and artist. I need to loop those requests and if there is are two request with the same song made to the same venue and date then i need to add then to a checkbox. For example:
#<Request id: 8, artist: "Metallica", song: "Turn the Page", venu...
Hey there,
I'm a first time stackoverflow poster, long time reader.
I'm dipping the toes into Rails and I'm trying to get git working.
I've installed git using the OSX git installer, and can see the manual with $man git. But I can't for the life of me get any other commands to work. I've restarted the terminal as well.
I'm on 10.5 if t...
I'm getting lot's of these exceptions in a Rails application:
ActionController::UnknownHttpMethod: CONNECT, accepted HTTP methods are get, head, put, post, delete, and options
As far as I see it seems to be some crawler or something like that trying to use CONNECT as an http verb. I've never heard of it, but the documentation say:
...
I have a method call in my view like this
<%= Navigation.with(params) do |menu|
if current_user && current_user.can_verify?
menu.item("Listings", manage_listings_path())
menu.item("Listing changes", needing_change_approval_manage_listings_path())
menu.item("Flagged Items", f...
Hi i am new to ruby on rails can you help me in writing a web service which uploads an image and stores in database.
Thanks in advance
...
The following error is occurred when I call @invitation = Invitation.new()....
#<ArgumentError: Unknown key(s): primary_key>
Unknown key(s): primary_key
C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/hash/keys.rb:47:in `assert_valid_keys'
C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_recor...
I've been using the acts-as-taggable-on for tagging in my development app, but when I push it to Heroku, I get a nasty error:
ActionView::TemplateError (PGError: ERROR: relation "tags" does not exist
: SELECT tags.*, taggings.tags_count AS count FROM "tags" JOIN (SELECT taggings.tag_id, COUNT(taggings.tag_id) AS tags_count FROM "taggi...
I am implementing a multi-page form and I want the user to be redirected to the same page if there is a validation error on a form, rather than the model's edit/new page. To get around this, I updated the controller action for the model so it redirects if the instance can not be saved. However, in doing so the error messages are lost -...
Hi,
What is the best way to add video uploading, encoding and streaming functionality to my Rails app ?
I'm thinking about a mix as : Rails app + Video Online Encoder + Amazon S3. What do you think ?
For the Video Online Encoder (VOE), which one is the easier to use with Rails : heywatch, panvidea, encoding.com, pandastream, ... ?
By...
Hello,
I have a collection of Blog items.
@blogs = Blog.find(:all)
Each blog has a description textfield with some text. What I would like to do is splitting the @blogs objects into 3 divs, but with roughly the same characters in each column.
<div id="left">
#blog1 (653 characters)
</div>
<div id="center">
#blog2 (200 characte...
Schema:
action_types
------------
id
name
description
actions
-------
id
action_type_id
date
description
The goal is to copy action_types.description to actions.description only if it is not occupied yet on the UI (!).
What is done:
class ActionsController < ApplicationController
active_scaffold :action do |c|
c.columns...
I am using whenever gem to create some cron job to fetch the data from a remote database.
My question is , does whenever gem has any functionality to handle errors? suppose connection to db failed during retrieval. Or is there any otherway in rails to read the error from cronjob?
...
Assume a polymorphic association, say 'business' and 'staff', both of which are 'hourable' (meaning they have hours assigned to them). What's the recommended approach to have the 'hour' model performs the same methods on the hours of either a business object or a staff object?
For a simple example, the 'hour' model might contain:
def...