ruby-on-rails-3.1

asset pipeline error but config.assets.enabled = false in application.rb

£可爱£侵袭症+ 提交于 2019-12-11 10:26:29
问题 I am deploying a first rails app via capistrano with: rails 3.1 passenger 3.0.11 nginx 1.0.10 The app errors out. In my $app/logs/production.log, I get: 5: <%= stylesheet_link_tag "application" %> 6: <%= javascript_include_tag "application" %> 7: <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> 8: <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/jquery-ui.js"></script> app/views/layouts/application.html.erb

Rails method that handles ajax complaining about no template?

自作多情 提交于 2019-12-11 09:55:33
问题 I have a subscriber#create method that is only used for ajax submits to it (the html form uses data-remote="true" to do the Ajax. The form does indeed submit and the data ends up in the db but the method throws an error saying that the template was not found. How can I specify a function as being an Ajax handler in Rails? -- one that doesn't have to render a template, etc. Here is what the method looks like: class SubscribersController < ApplicationController def create Subscriber.create(

ArgumentError (2 for 1):Rails3.1.0 <%= stylesheet_link_tag “application” %>

陌路散爱 提交于 2019-12-11 09:46:07
问题 wrong number of arguments (2 for 1) Extracted source (around line #5): <html> <head> <title>Assets</title> <%= stylesheet_link_tag 'application'%> <%= javascript_include_tag %> <%= csrf_meta_tags %> </head> I've tried: <%= stylesheet_link_tag :all %> but I got: <link href='assets/all.css' ...> What confused me most is that I run an app on my MAC OS with almost the same config except mysql&Gemfile and it works well, but when I turn to centos5 I got these errors! 回答1: I had this problem too,

Trying to update a record from within an Index using Best In Place

折月煮酒 提交于 2019-12-11 09:16:48
问题 I am trying to update a record from an index using either jQuery alone or the in-place editor "Best In Place". Not getting the checkbox and losing formatting on my <THEAD> row. I was using this rails cast as a guide but when I used the syntax on the checkbox Ryan used I got an error saying: Update: Ruby 1.8.7 syntax error, unexpected ':', expecting ')' Code-- Application.js: //= require jquery //= require jquery_ujs //= require_tree . //= require jquery.tablednd_0_5.js //= require jquery

How to use jquery-addresspicker jquery with rails 3.1

微笑、不失礼 提交于 2019-12-11 09:07:47
问题 I am trying to use jquery-addresspicker with rails 3.1 but I am not able to make it run. Here is the link https://github.com/sgruhier/jquery-addresspicker and the documentation does not mention much. Can anyone suggest how should I use it in my rails app? 回答1: did you include google maps <script src="http://maps.google.com/maps/api/js?sensor=false"></script> and jquery-ui ? 回答2: place the script code in the html, or in separate js file <script> $(function() { var addresspicker = $( "

Any New TextMate resources?

℡╲_俬逩灬. 提交于 2019-12-11 08:28:41
问题 So, I just installed OSX Lion and have been trying to get TextMate setup on it (first time using TextMate). I've found all these links about installing bundles, but I can't seem to get any of them to be loaded into the program. For instance, on pretty much all TextMate bundles, after you pull the code from github, this command is always listed: osascript -e 'tell app "TextMate" to reload bundles' Doing this gives me this response: 2011-09-16 17:32:55.276 osascript[19941:707] Error loading

whats wrong with my collection_select in my sign up view page

感情迁移 提交于 2019-12-11 08:09:56
问题 I am newbie to rails , I am using devise from ryan bates video tutorial , and , i am stuck at one point I have created user , role relationship and in the sign up page , i need to provide select option group for existing roles , in my sign up view page i am writing <%= collection_select(:user,:roles,Role.find(:all),:id,:name) %> i dont precisely understand collection_select method , kindly help what i might be doing wrong my models 1 : user.rb class User < ActiveRecord::Base has_and_belongs

paperclip image broken in rails 3.1rc4

你。 提交于 2019-12-11 07:44:24
问题 I am using rails 3.1rc4 with paperclip and i cannot upload any image file with. I keep getting this error Image D:/Users/MOBILE/AppData/Local/Temp/stream20110612-3872-y7hmme-0.jpg is not recognized by the 'identify' command. I have imagemagic installed. But it works in <= rails 3.0.8rc4. 回答1: I am not sure if this will adress your specific issue but I found this and maybe its related: https://github.com/thoughtbot/paperclip/issues/481 It states: The paperclip:refresh:metadata rake task fails

Undefined method error for filtering by age using Ransack gem

一曲冷凌霜 提交于 2019-12-11 07:26:53
问题 I am trying to filter results by age using ransack, but ransack is giving me an undefined method error. I have the Users DOB in my database and in my users model I have an age method that calculates the age of the user. It works perfectly fine and I am able to call the users age like this: @user = User.find(1) @user.age Now for ransack I have the following in my controller: def index @search = User.search(params[:q]) @users = @search.result end In my view, I have: <%= search_form_for @search

Ruby on Rails: Multiple Input Fields in The Same Form - Change ID/Value

微笑、不失礼 提交于 2019-12-11 07:22:59
问题 Have a page where there are multiple input fields of the same thing, Posts. Right now, when a user enters in a question for, let's say 3 fields, the only one that saves to the database is the last one. Whereas, it should save all three and give them each it's own post_id. Also; if the user doesn't enter anything in for the other fields, it should not save in the database either. new_step_4_html.erb <%= form_for(@post) do |f| %> <%= f.text_field :content %> <%= f.text_field :content %> <%= f