ruby-on-rails

current_user method is not accessible

hi.. i am using declarative_authorization... when i try to access current_user, it gives me the error undefined local variable or method `current_user'... can anyone help me out..? thnx... ...

How to dump data from mysql database to postgresql database?

I have done the depot application using mysql... Now i am in need to use postgres... So i need to dump data from mysql database "depot_development" to postgres database "depot_develop"... ...

Rails 3 Tree Data Structure

I have bees searching for a good solution for Tree Data Structure in Rails 3. I'm trying to build a Tree menu. What do you use and what would you recommend? ...

Rails authentication gift list for each user?

Hi Everyone, I am trying to get to grips with the basics of authentication in Rails. To start with I have used the nifty_authentication generator by Ryan Bates. It's helping me learn the basic options for user logins etc. I have a simple application the has a person and gift table in the database. The idea is, each user creates a list...

Ruby/Rails: Is it possible to execute a default method when calling an instance (@instance == @instance.all IF "all" is the default method)?

I understand my question is a bit vague but I don't know how else to describe it. I've asked in numerous places and no one seems to understand why I want to do this. But please bear with me, and I'll explain why I want something like this. I'm using Liquid Templates to allow users to make some dynamic pages on my site. And for those tha...

What's the best way to make Rails 3 / Active Record associations for classes of a simple point of sale program?

I have 5 classes that are part of a point of sales program: Customer, Technician, Order, Ticket, Service Each Order has one customer and many tickets. Each Ticket has on technician and many services. How should I make the associations so that I can do the following lookup: customer.order.find_by_date(10/20/2010).service.technic...

Customizing the confirmation_url in Devise

How do you customize this default line generated by Devise in the mailer view ? <p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p> I 've written a method in my controller called user_confirm. And have also defined a route for it. Can I get the url to link to tha...

Whats the maximum File size upload limlit in Internet explorer

Hi all, I would like to know whats Maximum Upload size in IE ,in my rails application am able to upload only upto 1.5GB ONLY uisng IE but using chrome am able to upload 10 gb without any fail ,Why it is so..I am running mongrel as server ...

Run PHP scripts stored inside Rails directory structure

Hello, I built a PHP application using Drupal and I want it to run under the same domain where Rails is running. So for example I have mysite.com running on Ruby on Rails, I would like to install and run Drupal in mysite.com/my_drupal_application. I tried creating a subfolder inside rails , on the same level as apps and models directo...

Rails Json response encoding

I've a rails controller that respond_to JSON with a wrong encoding. The site is correctly setup with UTF-8 encoding and the database as well. The text in my db is well formatted, but in the JSON response, all special characters are set to \ufffd. How can I solve the problem? ...

Tracing down routing errors in Rails

I am going through my first RoR tutorial and came up on an action controller routing error. I have checked my code at least 8 times, but can't figure out the issue. I'm sure this will happen again in the future. My question is, in general, how should I go about solving these errors? If it's relevant I am using RVM, Rails 3.0.1 and Ru...

Looking for 'act_as_sharable'ish gem

Is there a gem/plugin for rails that would facilitate resource sharing? E.g. user is sharing his photos (to view, comment) with other users. ...

Is there a way to make "rake routes" look better?

I am always forced to make my terminal window two dual monitors wide just to see read them right. I'm not a stickler for buttery GUI's, but this is bordering retarded. Is there a pretty print for this command? ...

File upload using attachement_fu in rails

Hi, I want to know how to upload files(other than images) using attachement_fu plugin in rails. I successfully uploaded images using attachement_fu, but wasn't able to upload other kinds of files. ...

Creating iphone & android apps for existing rails app

I've just spent a lot of time looking into the best ways to create iphone and android apps for an existing rails app that I've built and I feel that I haven't actually gotten any closer to knowing how to best achieve this. What I want: I would like to have the rails app and the mobile code cleanly separated. I'm not looking to just re...

Rails Utilizing a Model

I am working on a rails app that on the view side makes an Ajax call every 5 minutes or so to a controller to check if there are any new messages that were created for a particular user. Now I know the way of Rails (or MVC for that matter) is to use Fat Models/Skinny Controllers, how would I call my model from my controller so that the d...

render based on a condition, rails

Hello, I have a form displaying a nested relationship. The call to render the nested child objects is made like below: <% if @fpimgblocks %>   <% f.fields_for @fpimgblocks do |builder| %>     <%= render 'fpimgblock_fields', :f => builder %>   <% end %> <% end %> @fpimgblocks is the result of a find, I have verified there are zero resu...

How to make .NET development less of a black box to a Rails developer?

I have been spoiled by Ruby on Rails. However, my present 9-5 has me working with the Microsoft .NET framework--from classic ASP to ASP.NET to ASP.NET MVC. I'm struggling to understand more deeply our code, because I feel like I'm missing: script/server, or a live tail of a development log, to provide debuggable runtime info script/c...

Rails / ActiveRecord implementing a "Watch list" relationship.

I'm looking for advice on how best to construct a "watch-list" for the app I'm currently working on. Models as follows: # user.rb has_many :items # item.rb belongs_to :user I need to now add a watch-list, where users can favorite certain items, without taking ownership. I've tried the following: # user.rb has_many :items has_many ...

Rendering an active menu element in a menu partial in rails 3

I have a dynamic submenu that is rendered according to which page the user is on. I placed the following code in a _sub_menu.html.erb partial: <a href="/dashboard/index" class="current">Index</a> <a href="/dashboard/account">Account</a> <a href="/dashboard/payments">Payments</a>` From my my main view, I call <%= render 'sub_menu' %>, ...