I've added two namespaces into my routes that split the public and admin areas respectively. The idea is that they share models but the views and controllers are different for each namespace.
My admin namespace is /admin and my public namespace is just /
So...
map.namespace :admin, :path_prefix => "/admin", :name_prefix => "admin_" do...
Hi, I'm following the rails tutorial here: http://railstutorial.org/chapters/filling-in-the-layout#top
When i run "rspec spec/", i get a bunch of errors that look like this:
1) LayoutLinks should have a Home page at '/'
Failure/Error: Unable to find matching line from backtrace
stack level too deep
# C:/Ruby19/lib/ruby/1.9....
Does anyone know why
%select{:name => "dropdown"} expand »
- for say_text in @available_says
%option = h say_text
in HAML resolves to
<select name='dropdown'></select>
<option>a</option>
<option>b</option>
<option>c</option>
in HTML? It's stymieing my dropdown completely and the documentation all says "That should work." I can't i...
For example, I'm using "Bonus" as my model, so I'd expect "bonuses" to be the plural form and "bonus" to be the singular form.
However, in Ruby, this results in:
"bonus".pluralize # bonus
"bonuses".singularize # bonuse
So, when I do a "has_many :bonuses", for example, it doesn't use the Bonus.rb model (since Ruby expects a Bonuse.rb ...
I have called a function from a class to find all the items related to a particular ID in a many to many HABTM relationship.
Procedures -> Tasks with a join table: procedures_tasks
I call the information like @example = Procedure.get_tasks(1,1)
I would like to be able to iterate through the data returned so that I can create an i...
I'm using paperclip for attachments for multiple models using accepts_nested_attributes_for. Is there a way I can specify specific paperclip style options for each model?
...
Suppose in Ruby on Rails, there is a return of JSON data:
render :json => array_of_purchases
and this array_of_purchases contains many Purchase objects, each one with a product_id. Now if we want to add a property to the JSON returned, so that each Purchase object will also include its Product object data:
"product": { "id": 123, "n...
my routes should look like this:
>rake routes
GET /categories/:category_id/articles(.:format) {:controller=>"articles", :action=>"index"}
category_articles POST /categories/:category_id/articles(.:format) {:controller=>"articles", :action=>"create"}
new_category_article GET /cate...
In my rails app, I have a loop in my controller that does this:
event_prices = []
event_dates = []
for event in @customer.events
event_prices.push(event.total_prices)
event_dates.push(event.event_time.strftime("%b %d, %Y at %I%p"))
end
I then use the arrays to push data into a highcharts graph. What I want to do is sort the event_...
I'm a linux noob running Ubuntu 10.04 and trying to install rails. I first installed ruby and then RVM and then downloaded and installed rubygems and then installed rails.
Rails only seems to respond if I have a 'sudo' in front of the command. If I write 'rails new test' in the terminal I get this:
/usr/local/lib/site_ruby/1.8/rubygems...
This is a tricky one...
How can you tell if an ip, say 62.156.244.13 is within the range of 62.0.0.0 and 62.255.255.255
Is there a simple Ruby way to do this, or how can I solve this?
...
Hi, all
I need find friends activities:
SELECT `activities`.* FROM `activities`
INNER JOIN `friendships`
ON `activities`.user_id = `friendships`.friend_id
WHERE ((`friendships`.user_id = 1))
My add this code to User Model:
has_many :friends_activities,
:class_name => 'Activity',
:through => :friendships,
...
I'm in the process of creating my first rails plugin and am finding managing version control of the plugin and testing app rather annoying.
Here's my problem:
To actually test my plugin in action I need to run it within a test application (which is basically just a scaffold app where I install the plugin)
When I'm making changes to th...
Hi guys,
I've got a problem with linking unobtrusive js file with view.
I've got view named index.html.erb
...
<div id="fooBar">say bye!</div>
...
Also I've got js file index.js.erb
$("#fooBar").html("say hello!")
Currently I get say bye message, because javascript file are not executed.
What I'm doing wrong?
It seems to me th...
Background: I'm trying to create a simple feed reader for which I'm using the feedzirra. I am developing in Rails 3.
This is probably pretty simple, but I'm trying to figure out how to access the contents of two related models from a single view. The model relationship is as follows:
Feed has_many Entries
Entry belongs_to Feed
Thanks...
I am using jquery colorbox plugin as my popup/modal dialog box solution in my site. When I give a js response to client, I want to open a popup box. I wrote the following code in my response1.js.erb
$.colorbox();
I am getting the response correctly from server but while it is getting executed on the browser, firebug reports error like...
Hello,
I have deployed my Rails application on server.
It is working fine, but it crashed on sign_up page and server will be stop.
I Checked my mongrel.log file, it give the following error.
libgomp: Thread creation failed: Cannot allocate memory
How can I resolved this error?
Thanks.
...
I'm new to working with APIs. We're integrating Fedex into our Rails app. So we're sending API requests and receiving responses from them. For testing purposes, I would like to see the code of what we're sending out and receiving. I'm not sure how to do this.
What tools do you use for testing to view API requests and responses?
T...
In rails3, almost all query interface change to be lazyloading now, but 'will_paginate' will hit the database imediately after you use the 'paginate' method. How can I make it lazyload records?
...
Hi
In a Rails app, I am loading a partial via an ajax call. (still using prototype)
The partial is a form that contains a textarea enriched with the yahoo yui_editor (similar to tinyMCE or FCKEditor)
<%= f.text_area :body, :class => 'rich_text_editor', :rows => "15", :style => "width : 90%;" %>
The yui_editor is not loaded and the...