ruby-on-rails-3.1

undefined method `email' for nil:NilClass in Exibe the mail of table Father

放肆的年华 提交于 2019-12-01 08:54:43
问题 I have a problem, i make this atribbuition i comment model: class Comment < ActiveRecord::Base attr_accessible :comment belongs_to :post belongs_to :user and this in user model class User < ActiveRecord::Base attr_accessible :email, :password, :password_confirmation has_many :posts has_many :comments but this dont works: <% post.comments.each do |comment| %> <div id="comments" > <%= comment.user.email %> <%= comment.comment %> </div> <%end%> appear the error: undefined method `email' for nil

Rails 3: Ajax-updating a view with a partial

流过昼夜 提交于 2019-12-01 08:10:48
问题 what am I doing wrong with the following Ajax request...? The link/call: <%= link_to 'Business Analysis', it_business_analysis_path, :remote => true %> The route: match 'it/business_analysis' => 'informationtechnology#business_analysis', :as => :it_business_analysis The controller: class InformationtechnologyController < ApplicationController def business_analysis render :update do |page| page.replace_html 'page_content', :partial => 'business_analysis' end end end The view: <div id="page

Changing view formats in rails 3.1 (delivering mobile html formats, fallback on normal html)

丶灬走出姿态 提交于 2019-12-01 07:19:12
问题 I'm creating a mobile site next to our normal html site. Using rails 3.1. Mobile site is accessed in subdomain m.site.com. I have defined mobile format (Mime::Type.register_alias "text/html", :mobile). In ApplicationController I have "before_filter :mobile_site_before_filter" that recognizes mobile site and sets format according to it. def mobile_site_before_filter if request.subdomains.first == 'm' original_format = request.format request.format = :mobile @mobile_site = true request.formats

Rails 3.1 ajax:success handling

老子叫甜甜 提交于 2019-12-01 07:17:06
So Im playing with CoffeeScript, Rails 3.1 all the good stuff. I have a resource with all the usual routes index, show, create, edit, update, destroy. The index view has a form that uses :remote => true like so: <%= form_for @todo, :remote => true do |f| %> <div class="field"> <%= f.label :name %><br /> <%= f.text_field :name %> </div> <div class="actions"> <%= f.submit %> </div> <% end %> In the controller for create I have the following: def create @todo = Todo.new(params[:todo]) respond_to do |format| if @todo.save format.html { redirect_to @todo, notice: 'Todo was successfully created.' }

javascript runtime in rails 3.1.0 and ruby 1.9.2. cant deal with with heroku. Did everything, but still does not working

拈花ヽ惹草 提交于 2019-12-01 06:20:30
Please help, it's my studying project. It work locally but not online: Hello, it is said that i dont need special gems like "therubyracer" in rails 3.1.0 but it writes in "heroku logs": 2011-10-04T23:15:30+00:00 app[web.1]: ActionView::Template::Error (Could not fin d a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. 2011-10-04T23:15:30+00:00 app[web.1]: (in /app/app/assets/javascripts/rails.js )):.... i was trying to install "therubyracer" but i have error with installing it C:\proj\lagp>gem install therubyracer Temporarily enhancing PATH to

Errno::ENOENT (No such file or directory) in amazon-s3

南笙酒味 提交于 2019-12-01 05:53:03
I have application which is deployed to heroku using amazon s3 posting images to buckets.This works perfectly fine. But when fetching same image it gives error: Errno::ENOENT (No such file or directory showing path s3.amazonaws.com/bucket_name/app/public/messages/images/000/000/061/thumb/images.jpeg?1362410115) Same path copying and pasting in browser's url doesn't work. If I am using bucket name as end point it works ie, with following path /bucket_name.s3.amazonaws.com/app/public/messages/images/000/000/061/thumb/images.jpeg?1362410115. But I dont know how to configure this url in my model.

How to use dojo toolkit with rails 3.1 asset pipeline and coffeescript?

安稳与你 提交于 2019-12-01 05:50:15
I'm trying to use dojo-toolkit as the JS framework on a rails 3.1 app, but I'm struggling to incorporate the dojo require structure with the sprockets require and coffeescript. It seems dojo expects the JS files on the disk, but I guess they're created on the fly from coffeescript. Wondering if anyone has an idea of how the two require-s can co-exist. karellm I recently had to install dojo with rails 3.1 and the asset pipeline. Here are the steps I followed to make it work: 1/ Include Dojo Put the dojo SDK under vendor/assets/javascripts so you get the dojo, dijit and dojox folder in it.

Rails 3.1 ajax:success handling

时光总嘲笑我的痴心妄想 提交于 2019-12-01 05:40:12
问题 So Im playing with CoffeeScript, Rails 3.1 all the good stuff. I have a resource with all the usual routes index, show, create, edit, update, destroy. The index view has a form that uses :remote => true like so: <%= form_for @todo, :remote => true do |f| %> <div class="field"> <%= f.label :name %><br /> <%= f.text_field :name %> </div> <div class="actions"> <%= f.submit %> </div> <% end %> In the controller for create I have the following: def create @todo = Todo.new(params[:todo]) respond_to

Image showing as blank in Rails 3.1 on Production (Heroku)

陌路散爱 提交于 2019-12-01 04:03:09
I recently updated my Rails to 3.1. Here's a part where I added: <%= asset_path('logo_symbol.png') %> This renders /assets/logo_symbol.png which works perfectly fine in development environment. However, when i push the code to production on heroku, it shows a broken image, with the url: assets/logo_symbol-135ddc8db2c9b59f032bed7db520137a.png . I am guessing the new name is for the reason of some optimization. It is however interesting to note that when I go to the assets/logo_symbol-135ddc8db2c9b59f032bed7db520137a.png url on production, I see a blank page, but when I change that url to

How to use dojo toolkit with rails 3.1 asset pipeline and coffeescript?

放肆的年华 提交于 2019-12-01 04:01:26
问题 I'm trying to use dojo-toolkit as the JS framework on a rails 3.1 app, but I'm struggling to incorporate the dojo require structure with the sprockets require and coffeescript. It seems dojo expects the JS files on the disk, but I guess they're created on the fly from coffeescript. Wondering if anyone has an idea of how the two require-s can co-exist. 回答1: I recently had to install dojo with rails 3.1 and the asset pipeline. Here are the steps I followed to make it work: 1/ Include Dojo Put