Hi there,
Our host does not allow us to modify the passenger config file (i.e. the apache config OR the vhosts file), but we'd like to run rails in dev mode. So we have to specify the environment (prod/dev/test) in one of the files that rails loads AS the application is restarted. Anyone know how to do this?
We've tried the following wi...
hi all
I have successfully implemented jcrop and paperclip to crop images by going to another page ie the crop.html.erb
but i want to be able to do all cropping on my current page where i upload the image(s) in a popup div / dialog.
so somehow i need to load this the crop.html.erb page into a popup div on click. Here is the code on t...
If i have a configuration file like this
# config/environments/integration.rb
config.action_controller.session = {
:domain => ".example.com"
}
How do Ii get the value from within my application controller, e.g:
# app/controller/application_controller
class ApplicationController < Mcc::CoreSupport::FrontendController
def some_meth...
Can we make a mobile application with the help of RoR technology?
...
I'm using Authlogic to for my user authentication and want to offer our users the option of registering with a traditional user name/password or OpenID and/or Facebook Connect.
The problem I'm running into is that I need to save some additional user attributes that are not part of my User model. All that information is lost when the us...
How can I add span tags to the following link?
<%= link_to 'demo', :action => 'test', :path => '' %>
Should display like this:
<a href="/test"><span>demo</span></a>
...
In my Rails application I have these models
Order has_many OrderItem
OrderItem belongs_to Order
My controller has this (pseudo) code:
#before_filter
@cart = Order.find(session[:cart_id])
#Action: update_item
item = OrderItem.find(params[:item_id]
#The order, item belongs to, is in fact @cart, i.e. @cart.id == item.order.id
item.pri...
I am trying to create a bunch of dynamic helper methods like these:
show_admin_sidebar
show_posts_sidebar
show_users_sidebar
So far I have this in my helper.rb file:
#spits out a partial
def show_sidebar(name, show_sidebar = true)
@content_for_sidebar = render :partial => "partials/#{name}"
@show_sidebar =...
I need help figuring out the best way to do this.
Im using declarative authorization gem.
I have 4 roles, admin, master, junior, subscriber.
When it comes to new users:
I want the admins to be able to create any kind of user they wish.
But I also want masters to be able to create users with master, junior or subscriber roles.
So wh...
@xs stores urls like www.yahoo.com, www.google.com
for x in @xs
y = x... #do something with x
@result += y #i want to do something like that. i want to store them in @result. What do i have to write in here?
end
Sorry for noob question. By the way how do you call @result ? Is it an instance variable or an array ?
...
I have a problem with associations. As a newbie to RoR, I've learned about associations from the guide on the RoR site. I have followed one of the example almost to the letter, the only thing being changed are the class names. The example being the following:
class Document < ActiveRecord::Base
has_many :sections
has_many :pa...
I would like to raise an exception so that it does the same thing a normal Rails exception does. Specially, show the exception and stack trace in development mode and show "We're sorry, but something went wrong" page in production mode.
I tried the following:
raise "safety_care group missing!" if group.nil?
But it simply writes "ERR...
I know nothing about RoR and now I need video tutorials for learning RoR
any links to download or watch please
...
I am using the authlogic gem for user validation on one of my sites. All is going well, but I am wondering if it's possible to change the error message that gets returned when the user types in an invalid email address.
Thanks!
...
Hi,
Wondering if someone can suggest a refactoring 'best practice' or more ideally a "check-list" that we can go through and refactor against common issues.
Some of these ideas were pretty good: http://my.safaribooksonline.com/9780321620293
But looking for more.
Thanks.
...
Hi,
Ruby on Rails question - where is the first point in rails code that a request hits?
(I can then add some logging code there as I want to measure some response times)
Regards
...
Is there a simple HTTP server that can be run in the current PHP project path, like Rails' script/server (webrick)?
...
I know that if I want to call a helper of another controller, I can do something like:
helper :other_controllers
But I was wondering why I can't do something like OtherControllersHelper.method inside the view?
...
Hey,
So I am generating XML data in my RoR application for an external source to consume. The method in my controller is as follows...
def allOffers
@ridesall = Ride.find(:all)
respond_to do |format|
format.xml
end
end
I have a allOffers.xml.builder file that looks like this...
xml.instruct!
xml.rides do
@ridesall.each do |r...
hi all,
I have a problem in calling autocomplete function which exist's in the controller,as soon as i enter a character i should find the dropdown of matching strings from the database of a particular table user.
In my user.html.erb has autocomplete textfield
<%= text_field_with_auto_complete :user,:name,{}, :skip_style => true ,:au...