My User model contains :name, :email, and :password fields. All 3 have validations for length. An "update account" web page allows the user to update his name and email address, but not password. When submitted, params[:user] is
{"name"=>"Joe User", "email"=>"[email protected]"}
Note there is no "password" key because the form doesn...
I have a couple different user types (buyers, sellers, admins).
I'd like them all to have the same account_path URL, but to use a different action and view.
I'm trying something like this...
class AccountsController < ApplicationController
before_filter :render_by_user, :only => [:show]
def show
# see *_show below
end
def...
*update: horray! so it is a journey of practice and understanding. ;) now i no longer feel so dumb.
I have read up many articles on REST, and coded up several rails apps that makes use of RESTful resources. However, I never really felt like I fully understood what it is, and what is the difference between RESTful and not-restful. I also...
I've got a table with five columns, one of which is the primary key. This primary key is using a non-standard name, like nearly all tables in that database. I've added a migration to rename the other four columns in that table. The problem is after running that migration, the primary key constraint is gone! I've done that renaming thing ...
I have a comment form (in comments/_form.html.erb) that I use in my other controllers (posts and tags).
<% form_for([@post, Comment.new], :html => { :multipart => true }) do |f| %>
<%= f.text_field :commenter %>
<%= f.text_field :email %>
<%= f.text_area :body %>
<%= f.submit 'submit' %>
<% end %>
In my Comment mo...
I am new to Rails.
I have a User model. I would like a web page that allows users to change their :name and :email, and another web page that allows them to change their password.
Right now, I have a form to edit :name and :email at
/users/1/edit
The form on the page is
<%= form_for(@user) do |f| %>
My routes.rb has
resources :...
I've got an admin section setup, but am having trouble getting the "update" route to work.
Getting error when hitting "update" via the edit view:
"No action responded to 2."
For some reason the route is responding to the :id as the :action.
Parameters:
Parameters: {"commit"=>"Update", "action"=>"2", "_method"=>"put", "admin"=>{"ende...
Can anyone suggest sample code for a view and controller, to search youtube from a rails app and display results in the same app?
Patching together first rails application, and this is the only functionality that has no obvious documentation for my specific problem.
...
I have a simple problem regarding a loop in a Rails controller.
Here's the original sample code, the purpose of which is to specify the data to be used in an open flash chart (pie chart).
#controller
data_1 = [
OFC2::PieValue.new(:value => 20, :label => 'GroupA', :font_size => 15),
OFC2::PieValue.new(:value => 30, :label => 'Grou...
What stuff does each one do (or, generate?) pardon the pun.
...
class PostsController < ApplicationController
# GET /posts
# GET /posts.xml
def index
@posts = Post.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @posts }
end
end
...
What exactly is "respond_to" Is it
part of rails?
What is "do" and"|format|"? Why are there verti...
I have a timestamp that represents the last time a particular record was viewed. I want to present to the user a display that gives a human readable representation of the difference between that time and now.
So it should be something like
"Last viewed 38 seconds ago"
or "Last viewed 1 hour 15 minutes 10 seconds ago"
Is there a qui...
I'm doing a search on a model, like this:
search_results = Note.description_like("test string")
So I've got an array of notes. I want to order them by the frequency that the note_id appears in a join table I have, note_categories. How can I do this?
...
At the moment, any logged in user can go to http://localhost:3000/notes/note_id and view the note there. How do I restrict this so that you can only see notes that belong to you? Thanks for reading.
...
I built a small cms for personal websites using Rails. Each site has a simple blog.
I've been looking for a good third party comment system to add to the cms.
Have you used (or know of) any "comment service" that I can seamlessly integrate via their API, and if they have a ruby gem even better.
Thanks in advance
Deb
...
I have the same issue as http://stackoverflow.com/questions/3027555/creating-an-additional-related-model-with-devise (which has no answer).
I have overridden the devise view for creating a new user and added a company name, I have changed the model to use accepts_nested_attributes_for
There are no errors, but it is not adding the neste...
I have been struggling to get a simple autocomplete working with my Rails app using the jQuery UI 'autocomplete' I'm already using jRails, so I tried using the jrails_auto_complete
I set it up like it says in the README, but I get the following javascript error when I start typing in the box:
Failed to load resource: the server respon...
I have the following associations:
class BookShelf {
has_many :books
}
class Book {
has_many :pages
belongs_to :book_shelf
}
class Page {
belongs_to :book
}
If I have a BookShelf object, how could I use searchlogic to search pages that belong to the books in the current book shelf?
Currently I'm using this one:
@bookshelf ...
Guys,
I need to test the following helper:
def display_all_courses
@courses = Course.all
output = ""
for course in @courses do
output << content_tag(:li, :id => course.title.gsub(" ", "-").downcase.strip) do
concat content_tag(:h1, course.title)
concat link_to("Edit", edit_course_path(course))
end
end
...
I recently integrated authlogic_facebook_connect into my application.
However, I've discovered that it seems to have some real problems with keeping track of user sessions, and even after logging someone out, the next person that logs in with Facebook will be logged in as the prior user.
I found a fix for this, and manually integrated ...