Everytime i get a warning:
app/controllers/agency/agencies_controller.rb:1: warning: toplevel constant ApplicationController referenced by Agency::ApplicationController
My agencies_controller.rb:
class Agency::AgenciesController < Agency::ApplicationController
def index
...
end
...
end
And Agency::ApplicationController...
I'm trying to get my Rails app to serve XHTML content properly, with the correct content-type of application/xhtml+xml. Ideally with content negotiation so that IE users get a chance to use the site too.
Given that all the HTML generated by Rails is marked at XHTML 1.0 Transitional, I'm a bit surprised that there is no obvious option to...
Ok, I'm not sure that my title was clear enough, but I will try to explain
I have two tables: orders that has_many items and items that belongs_to orders.
I just started to learn RoR and stuck with a simple task. All I want is to
display orders and related items like this:
Order 1:
Item 1
Item 2
Order 2:
Item 1
Item 2
...
I k...
Asp.net WebForms and MVC has a concept of Masterpages which make it easy to define a one time layout for all the page of your site. In Rails I'm struggling to find an equivalent usage pattern or feature.
From what I've read it's really easy to define a layout in every action with:
layout: 'viewname'
Now that seemed pretty ceremonial...
I'm having trouble runnng rspec2 and rails. Here's my log:
1) TrackController home path should be /track
Failure/Error: Unable to find C to read failed line
undefined method `route_for' for #<#<Class:01x5ffe7c2f>:0x77d36efb>
# ./spec/controllers/track_controller_spec.rb:5
# :1
Here's my spec:
describe UsersController,...
Is there a direct correlation on site speed with the number of namespaces / routes in the routes.rb file of a Rails Application?
I am handling a fairly large application with more than 30 disparate models/entities and most of these resources have their own routes.
...
I've been working on a rails app for a couple of days now that I need an underlying "middle layer" for that connects my rails application to the various services that make up the data.
The basic setup looks like this:
Frontend ("Rails app") -> user requests data to be aggregated -> info goes in database and a JSON request is sent to "...
Hi,
I'm having some troubles with my Rails app after installing (and removing) Compass. bundle install gives me the following:
/Users/[..]/.rvm/gems/ruby-1.9.2-head@rails3beta/gems/bundler 1.0.0.beta.2/lib/bundler/settings.rb:10:in `[]': undefined method `[]' for false:FalseClass (NoMethodError)
from /Users/[..]/.rvm/gems/ruby-1.9.2-he...
i'm using restful-authentication plugin with rails 2.3.8
i've problems with cookies store
i've put a logger instruction in this function for check the cookie:
def send_remember_cookie!
cookies[:auth_token] = {
:value => @current_user.remember_token,
:expires => @current_user.remember_token_expires_at }
...
I have a Profiles Controller that acts_as_authentic with AuthLogic and I am trying to test this action:
class ProfilesController < ApplicationController
before_filter :require_user, :except => ['new', 'create']
def index
redirect_to(current_user)
end
end
The following example is in a spec file with 18 other pending examples...
I've been struggling with this problem for a few hours and it is preventing me from even starting my server, which therefore is stopping development completely.
I am running Windows, Bitnami Rubystack, and that's pretty much it. I downloaded and installed NetBeans yesterday but my primary editor is Notepad++. I am not using JRuby.
Here...
Hi, all.
I have 3 classes:
class User < ActiveRecord::Base
has_many :events, :foreign_key => 'owner_id'
end
class Event < ActiveRecord::Base
belongs_to :owner, :class_name => 'User', :foreign_key => 'owner_id'
end
class Event::User < Event
end
Class Event have 'type' field, and work as STI.
Now i create Event:
Event::User.cre...
I'm finding that XML and JSON serialization in Rails 2.3.5 don't seem to work the same. Has anyone encountered this and come up with a workaround?
class Record < ActiveRecord::Base
...
def my_method
{ :attribute1 => 'value1', :attribute2 => 'value2' }
end
...
end
@record.to_json(:method => [:my_method])
returns correct JSON...
So I want to dynamically generate a MIDI file on a web request.Coming from the Java world, I expected something to the tune of
class MidisController < ApplicationController
before_filter :set_content_type
def set_content_type
@headers["Content-Type"] = "audio/midi; charset=utf-8"
end
def show
midi_data = get_midi_da...
I have a set of regions and cities (nested) and want to be able to output them in a few even length columns ordered alphabetically. For example:
[Alberta] [Ontario] [Quebec]
Calgary Hamilton Hull
Edmonton Kitchener Laval
[Manitoba] Ottawa Montreal
Winnipeg Toronto
Waterloo
I took a look at 'in_gr...
I am a newbie to rails and i needed to execute some sql query and output it to the view. In my controller i used something like "@prob = ActiveRecord::Base.connection.execute("...") and then simply displayed the @prob in the view. However the output in the view keeps coming twice as 0 result column name result .
The sql query was
@cp...
I need to scrape some websites, and would like to avoid downloading images from the pages I am scraping - I only need the text. I am hoping this will speed up the process. Any ideas on how to manage this?
Thanks,
Jon
...
I would like to implement a simple search. Let's say the user enters 'york', then I would like to find all records that has a matching substring like 'new york' or 'yorkshire'.
So far I have figured out I will have to use the find method, but I can't figure out how to match for substrings.
...
Hi
I have one input field and 2 buttons, each button performs a different function. i want one of the buttons to take the value of the input field and add it to a specified Url (as a param) that button should go to.
so if the value inserted in to the box is "dog" then after clicking the button the URL should be "/go_somwhere?value=dog"...
Hi!
How can I get all relationships for model. IE, I've got User model:
class User < AR::Base
has_many :messages, :foreign_key => 'author'
has_many :posts
belongs_to :role
end
So how can I know which relationships User model has got? And foreign_keys if they are presented.
...