ruby-on-rails-3.1

Nodejs/rails/backbone architecture

那年仲夏 提交于 2019-12-08 08:14:33
问题 I have an app that I'm building which very much works like craigslist but with limited functionality. I generally would use Rails for this kind of app but I'm interested in learning nodejs/backbonejs framework and it seems like this is a good opportunity to pick it up. I'm not sure how nodejs and/or backbonejs fits in this solution? I don't necessarily have to use rails, I'm fine with using nodejs and backbonejs if that makes sense. Thanks 回答1: You certainly can use Node.js or Rails or both

Error in Rails 3.1 using js jQuery - “Template is missing”

别说谁变了你拦得住时间么 提交于 2019-12-08 07:46:44
问题 I created app according to this post http://stjhimy.com/posts/7-creating-a-100-ajax-crud-using-rails-3-and-unobtrusive-javascript , but get an error: Missing template posts/create, application/create with {:handlers=>[:erb, :builder, :coffee, :haml], :formats=>[:html], :locale=>[:en, :en]}. Searched in: * "/home/ember/Projects/test_app/app/views" Maybe in Rails 3.1 actions render something by default. Besides, there no format js (:formats=>[:html]). But i can`t find any about this. When i

Rails 3.1: Sqlite exception

不羁岁月 提交于 2019-12-08 07:16:18
问题 I try to launch really simple Ruby on Rails app on VDS. I use Nginx, Phusion Passenger and Sqlite3. I have root rights. Code of creating project: $ rails new myapplication $ cd /rails_apps/myapplication $ bundle install $ rails generate scaffold Post name:string title:string content:text $ RAILS_ENV=production rake db:migrate I can visit main page, it shows ok. But when i try insert data into DB, i get next: SQLite3::ReadOnlyException: attempt to write a readonly database: INSERT INTO "posts"

How to efficiently work with multiple database tables in Ruby on Rails

余生长醉 提交于 2019-12-08 06:38:13
问题 I've giving myself a small project to help me improve with my ruby on rails programming. So far I've completed full user signup and authentication with password reset, a remember me feature and notification emails. I totally understand what is going on. So I've now moved to the user account area and would like to code the page that my user would edit their profile on. My signup form only asked for username, email and password as I wanted quick registration. For the page where users will edit

Date reverts to 2000-01-01 from ActiveRecord to MySQL

青春壹個敷衍的年華 提交于 2019-12-08 06:05:27
问题 I am trying to save a time in a MySQL table. However, the date reverts to 2000-01-01. 1.9.2p320 :036 > vv = Visitor.new => #<Visitor id: nil, ip_address: nil, num_day_visits: nil, last_visit: nil> 1.9.2p320 :037 > vv.last_visit = Time.now; vv.ip_address = "3.3.3.3" => "3.3.3.3" 1.9.2p320 :038 > vv.num_day_visits = 1 => 1 1.9.2p320 :039 > vv => #<Visitor id: nil, ip_address: "3.3.3.3", num_day_visits: 1, last_visit: "2012-10-11 01:31:04"> 1.9.2p320 :040 > vv.save SQL (0.2ms) BEGIN SQL (0.7ms)

How to Write a Simple Nested, has_many :through, many-to-many Form in Rails 3.1?

邮差的信 提交于 2019-12-08 05:47:15
问题 I am building a recipe manager as a first rails app. I have a many-to-many, nested set of models based on this quite nice ERD. Ideally, I would like to create a form that allows me to create the recipe in a single form. Also, I would like the user to be able to write/paste the ingredients and steps into a single text field, respectively. In the code below, there is a virtual attribute that parses the cr separated lists in the form to attempt this. I keep getting a "readonly" has_many through

Images desapears after deploy Rails 3.1.3 on Heroku Cedar

耗尽温柔 提交于 2019-12-08 05:44:23
问题 After deploy on heroku cedar, images desapear. I've a CSS like : :css /* */ table.table thead .sorting { background: url('assets/datatables/sort_both.png') no-repeat center right; } table.table thead .sorting_asc { background: url('assets/datatables/sort_asc.png') no-repeat center right; } table.table thead .sorting_desc { background: url('assets/datatables/sort_desc.png') no-repeat center right; } /* */ table.table thead .sorting_asc_disabled { background: url('assets/datatables/sort_asc

Rails 3.2 ActionMailer handle unsubscribe link in emails

时光总嘲笑我的痴心妄想 提交于 2019-12-08 05:43:45
问题 I have a list of customers that I send emails using an ActionMailer mailer. I am trying to code a link at the bottom of each email so a customer can unsubscribe from a mailing. So far I have an opted_out field in my customers database, I am simply unsure how to properly set up the route and have it update the correct database field. I want to design this so the user can simply click the link and viola, unsubscribed. in blast_mailer.rb def mail_blast(customer, blast) @customer = customer

Adding urls api keys in environment variable in ruby

╄→гoц情女王★ 提交于 2019-12-08 05:43:41
问题 I have a url that I am using in one of the controllers. Is there a better place to put this url? The url uses an API key and I was wondering if there is a better place to add this url and/or api key such that its not added in the controller class code and ergo more editable? If i add it as an environment variable or anything else how do i access it from my controller class? thank you. ITS A RUBY AND RAILS PROJECT 回答1: Using environment variables might be a good idea if you want to keep things

Sending data in my form hidden field

安稳与你 提交于 2019-12-08 05:30:21
问题 I am trying to add a jquery upload But i need to pass a parameter into my form Here the form <%= form_for Photo.new do |f|%> <%= f.label :title %><br /> <%= f.text_area :title, :rows => 3, :value => "Add a photo", :onclick=>"this.value='';" %> <%= f.file_field :photo, multiple: true %> <%= f.hidden_field('event_id', params[:event_id]) %> <%= f.submit "Add Picture" %> <% end %> But this doesn't work, the issue is I have a link has follow localhost/events/16/photos/useradd where 16 is the event