Recent Posts

Subscribe to Recent Posts 404 post(s) found

Pages: 1 2 3 4 5 6 7 8 9 10 11 ... 17

Sep 1, 2008
Avatar EldonAlameda 189 post(s)

Topic: Church Community Discussion / small_avatar problems

Finally got some free time to work on this tonight and haven’t quite identified the problem because it seems that for some reason the User class is being re-initialized after the first few requests (minus all of it’s associations, methods, etc). I’m still suspecting that it has something to do with one of the plugins – but can’t find anything yet

However a quick work around for this – If you go into /config/environments – you have several environment files in there (development. production, test).

These have a setting that says
config.cache_classes = false

If you change that to true (and then restart your app) then it will only load the user model once and then keep using it.

 
Aug 29, 2008
Avatar dwmills 1 post

Topic: Church Community Discussion / small_avatar problems

Just wanted to add my “vote.”

I am having the same issue. The small_avatar is “undefined.”

Just like Evan, I have seen this work once correctly, and fail many times.

I tried changing small_avatar to small_avatarx, but this did not change anything.

Here is the error:

NoMethodError in Posts#show

Showing posts/show.rhtml where line #24 raised:

undefined method `small_avatarx’ for #<user:0x22b9970>
Extracted source (around line #24):

21:


  • 22:

    23:

    24:

    <= link_to(image_tag(user.small_avatarx), showuser_path(:user => user)) %>

    25: <= link_to user.name, showuser_path(:user => user) %> posted


    26:

    27:

  •  
    Aug 19, 2008
    Avatar Evan 2 post(s)

    Topic: Church Community Discussion / small_avatar problems

    Eldon,

    Definitely, I’ll send it over right away. Thanks so much for helping out!

    Evan

     
    Aug 18, 2008
    Avatar EldonAlameda 189 post(s)

    Topic: Church Community Discussion / small_avatar problems

    Evan,

    I don’t think that i ever got a response from Derrick with his project. Could you zip up the project as you currently have it and send it to my above email address. Since I can’t re-create the issue in any of my versions of the application it makes it hard to troubleshoot. I won’t be able to look at it until late tommorow at the earliest, but I’ll certainly do my best to see if I can figure out what’s causing the issue for you.

    Eldon

     
    Aug 18, 2008
    Avatar Evan 2 post(s)

    Topic: Church Community Discussion / small_avatar problems

    Hey guys,

    I am having a similar problem to Derrick. Whenever I try to access a comment’s user’s avatar Rails returns this:

    “ActionView::TemplateError (undefined method `avatar’ for #<user:0x2b4d6165f8e0>) on line #26 of posts/show.html.erb:
    23:


  • 26: <= image_tag user.avatar.public_filename(:comment) >
    27:


    28: <= link_to user.name, showprofile_path(:user => user) > posted on <= comment.created_at.to_s(:short) %>
    29:

    I was using the show_small_avatar method but ran into the same problem and tried this code as a workaround. What is worse is this code works once about every 5-10 minutes and then fails to 500 every time after.

    Any ideas?

    Edit note: sorry about the formatting, I am new here :)

  •  
    Jul 26, 2008
    Avatar EldonAlameda 189 post(s)

    Topic: Announcements / Ext JS

    Hi MFlynn,

    Glad you liked the book!

    Actually I haven’t gone back and done any notes on upgrading the projects to Ext 2.0. I’ve been doing contract work with the National Weather Service for the last year which didn’t have any need for any of the advanced functionality of Ext and no one had requested it so I haven’t played with Ext for quite a number of months.

    I did experiment with this plugin idea and thought it had some interesting ideas for making it easier for integrating Ext w/ Rails.

     
    Jul 26, 2008
    Avatar mflynn 1 post

    Topic: Announcements / Ext JS

    Eldon, thanks for a really good book. It’s got more useable content in it than any of my stack of Rails books.

    Any chance you’ve been able to make some notes about converting the projects to Ext 2.0?

     
    Jul 13, 2008
    Avatar theelbster 3 post(s)

    Topic: Exercisr Discussion / Having trouble with the welcome screen

    Hi Eldon,

    It looks like copy/paste turned out horribly here. Also, I should mention that there may be version conflicts (btw the version written about in your book and the one I’m actually using) at play here.
    I’m using OSX 10.4.11
    ruby -v => ruby 1.8.6
    rails -v => Rails 2.1.0

    Routes.rb before:
    ActionController::Routing::Routes.draw do |map|
    map.resources :exercisers
    map.home ’’, :controller => ‘sessions’, :action => ‘new’
    map.resources :users, :sessions
    map.welcome ’/welcome’, :controller => ‘sessions’, :action => ‘welcome’
    map.signup ’/signup’, :controller => ‘users’, :action => ‘new’
    map.login ’/login’, :controller => ‘sessions’, :action => ‘create’
    map.logout ’/logout’, :controller => ‘sessions’, :action => ‘destroy’
    map.connect ’:controller/:action/:id’
    map.connect ’:controller/:action/:id.:format’
    end

    routes.rb after:
    ActionController::Routing::Routes.draw do |map|
    map.resources :exercisers
    map.home ’’, :controller => ‘sessions’, :action => ‘new’
    map.resources :users, :sessions
    map.signup ’/signup’, :controller => ‘users’, :action => ‘new’
    map.login ’/login’, :controller => ‘sessions’, :action => ‘create’
    map.logout ’/logout’, :controller => ‘sessions’, :action => ‘destroy’
    map.welcome ’/welcome’, :controller => ‘sessions’, :action => ‘welcome’
    map.connect ’:controller/:action/:id’
    map.connect ’:controller/:action/:id.:format’
    end

     
    Jul 12, 2008
    Avatar EldonAlameda 189 post(s)

    Topic: Exercisr Discussion / Having trouble with the welcome screen

    Hi theelbster,

    What did your routes look like before? and after?

     
    Jul 12, 2008
    Avatar theelbster 3 post(s)

    Topic: Exercisr Discussion / Having trouble with the welcome screen

    UPDATE: I finally figured it out. I had to move the map.welcome line to after map.logout. I don’t at all understand why, but it works at least.

     
    Jul 12, 2008
    Avatar theelbster 3 post(s)

    Topic: Exercisr Discussion / Having trouble with the welcome screen

    I’m at the point in this exercise where I can create a user (name, email, password, password-conf), but when I submit that form, I get the following error:

    ActionController::MethodNotAllowed
    Only get, head, post, put, and delete requests are allowed.
    RAILS_Root: /usr/local/exercisr
    Headers:
    (“cookie”=>[], “Cache-Control”=>”no-cache”, “Allow”=>”GET, HEAD, POST, PUT, DELETE”}

    As far as I can tell, there is a problem with the welcome path, but I can’t figure it out. Any help would be appreciated.

    Here are the contents of my files:
    .../config/routes.rb:
    ActionController::Routing::Routes.draw do |map| map.resources :exercisers map.home ’’, :controller => ‘sessions’, :action => ‘new’ map.resources :users, :sessions map.welcome ’/welcome’, :controller => ‘sessions’, :action => ‘welcome’ map.signup ’/signup’, :controller => ‘users’, :action => ‘new’ map.login ’/login’, :controller => ‘sessions’, :action => ‘create’ map.logout ’/logout’, :controller => ‘sessions’, :action => ‘destroy’ map.connect ’:controller/:action/:id’ map.connect ’:controller/:action/:id.:format’
    end

    .../app/controllers/application.rb:
    class ApplicationController < ActionController::Base helper :all # include all helpers, all the time before_filter :login_from_cookie session :session_key => ‘_exercisr_session_id’ include AuthenticatedSystem

    1. See ActionController::RequestForgeryProtection for details
    2. Uncomment the :secret if you’re not using the cookie session store protect_from_forgery # :secret => ‘c3f7d2ecee34d3b3ff8e9117984956ee’
      end
    .../app/controllers/sessions_controller.rb:
    1. This controller handles the login/logout function of the site.
      class SessionsController < ApplicationController # render new.rhtml def new end
    def create
      self.current_user = User.authenticate(params[:login], params[:password])
      if logged_in?
        if params[:remember_me] == "1" 
          current_user.remember_me
          cookies[:auth_token] = { :value => self.current_user.remember_token , :expires => self.current_user.remember_token_expire        s_at }
        end
        redirect_back_or_default(welcome_path)
        flash[:notice] = "Logged in successfully" 
      else
        render :action => 'new'
      end
    end
    def welcome
    end
    def destroy
      self.current_user.forget_me if logged_in?
      cookies.delete :auth_token
      reset_session
      flash[:notice] = "You have been logged out." 
      redirect_back_or_default(login_path)
    end
    end

    .../app/controllers/users_controller.rb
    class UsersController < ApplicationController # render new.rhtml def new end

    def create
        @user = User.new(params[:user])
        @user.save!
        self.current_user = @user
        redirect_back_or_default(welcome_path)
        flash[:notice] = "Thanks for signing up!" 
      Rescue ActiveRecord:RecordInvalid
        render :action => 'new'
      end
    end

    end

    .../app/views/sessions/new.html.erb:
    <% form_tag sessions_path do ->

    <label for="login">Login</label>

    <= text_field_tag ‘login’ %>

    <label for="password">Password</label>

    <%= password_field_tag ‘password’ %>

    <!- Uncomment this if you want this functionality

    <label for="remember_me">Remember me:</label>
    <%= check_box_tag ‘remember_me’ %>


    ->

    <= submit_tag ‘Log in’ %>


    < end -%>

    .../app/views/sessions/welcome.rhtml:

    Welcome to Exercisr


    A RESTful place to keep track of your workouts

     
    Jul 4, 2008
    Avatar EldonAlameda 189 post(s)

    Topic: Simple Blog Discussion / web services

    Phantom,

    The ideal of the REST interface is more that it supports a common set of conventions. So there’s no need to provide a WSDL to the clients. It’s just a few standard HTTP calls and processing of XML.

    Using ActiveResource makes it a seemingly painless process for for Ruby clients – but that doesn’t mean that other languages can’t interface to it.

    In fact, if you’re looking for some examples of interfacing to a RESTful Rails application from other languages – a good book to look at would be Ben Scofields Practical REST on Rails projects book. In the book, he creates a fairly simple (scaffolded) Rails application and then spends the rest of the chapters showing different ways to interface to it via REST (i.e. from a javascript widget, from a PHP (squidoo i think), facebook, etc, etc.

     
    Jul 4, 2008
    Avatar phantom 1 post

    Topic: Simple Blog Discussion / web services

    hi there,

    i need to implement web services in my rails 2.0.2 app for external apps to consume. whilst i’d prefer to do things the REST way, i’m struggling to work out what i need to supply (a la WSDL) to the other apps so that they know the structure of the request that they must send me.
    i have looked at activeresource, but that appears to be more appropriate when i’ve got a rails app to consume web services; it’s likely that the external apps i need to respond to won’t be written in rails.
    unless i can sort this problem out, i imagine i’ll need to go back to activewebservice. so, am i missing something blindingly obvious here, or is this something that people simply haven’t needed to do in rails ?

    thanks,

    phantom

     
    Jun 12, 2008
    Avatar raels 1 post

    Topic: Announcements / Starting New Book

    1) Yes! The move from CRUD to RESTFul development has changed many things about how apps should be structured, and there are also the controversies in the deep-nesting vs shallow-nesting tribes. So something that would be great to understand better as a Rails newbie is how to structure applications in relation to the user activities. For instance, should I partition my app into two groups, one that is totally RESTful and essentially represents the items they present, and another group that presents HTML pages to users in ways that are very convenient to the users, but maybe not so RESTful? Another issue is how to deal with the lack of components—while there is a push to make apps look like their data model, my customers want apps that are convenient, meaning that a single page may include many different views of many models all at the same time. With components being deprecated, how do I structure something that customers like but is still Railsworthy? These are the kinds of questions that I have found most difficult.

    2) It is excellent! However, please make sure that the illustrations and figures match the code purported to produce them. For instance, on Page 406 of your book, you have code for an EXTJS layout that may in fact match just the layout component of figure 18-3, but there is a bunch of stuff in figure 18-3 that doesn’t appear in that code. Rails has been a huge experiment in determining (an remembering) which expressions yield which results, based on defaults, hidden functionality, etc. There isn’t anything for theme support or a library in that code—so my natural Rails paranoia about defaults was applied to this example. Lost a lot of time as a result.

    3) It was hard to follow some of the folded lines in the examples—I would use a smaller font for code to eliminate as many folded lines as feasible.

    4) It would help to know what one needs to do to convert a pre-2.0 app to 2.0, particularly WRT the apps in your previous book. Also, indications as to which of the burgeoning rails 2.0 sites are the best to monitor—like everything else on the net, the signal to noise ratio is pretty low. Anything that points to resources that helps one write, upgrade and generally maintain an app across Rails version upgrades is great!

    I liked your book quite a lot—it is one of two that I use almost every day when coding.

    -r

     
    Jun 11, 2008
    Avatar EldonAlameda 189 post(s)

    Topic: Church Community Discussion / small_avatar problems

    alameda[dot]eldon[at]gmail[dot]com

     
    Jun 11, 2008
    Avatar derrick 3 post(s)

    Topic: Church Community Discussion / small_avatar problems

    Yes, I can send it. Where should I send the project?

     
    Jun 9, 2008
    Avatar EldonAlameda 189 post(s)

    Topic: Church Community Discussion / small_avatar problems

    Derrick,

    I’ve gone through the app but haven’t been able to reproduce your issue. (granted my current dev system currently has ImageMagick disabled for another project I’m on) but don’t think that would make a difference.

    Is there any way you could zip up your version of the app and send it to me so I could take a look through your code?

    Thanks

     
    Jun 7, 2008
    Avatar derrick 3 post(s)

    Topic: Church Community Discussion / small_avatar problems

    The small_avatar method is there. I downloaded the code that was provide from railsproject.

    I had the server running locally on a mongrel server. In addition, I have hosted the same code on dreamhost using their server, yet the problems persist.

     
    Jun 4, 2008
    Avatar EldonAlameda 189 post(s)

    Topic: Church Community Discussion / small_avatar problems

    Hi derrick,

    Sorry for the delay – I’ve been at RailsConf the last week and wasn’t checking my messages back here very often.

    could you confirm that your user model (/app/models/user.rb) contains the small_avatar method?

    Also could you tell me what type of server setup you’re running? It’s extra strange if it works in console on that server but not directly from the server – unless you’ve got an old process still running an older version of the code.

    Thanks

    Eldon

     
    Jun 1, 2008
    Avatar derrick 3 post(s)

    Topic: Church Community Discussion / small_avatar problems

    I’m having trouble with the small_avatar call from the photo/display.rhtml and post/display.rhtml. To ensure I was doing everything correctly, I downloaded the code from book and deployed it on the server. Unfortunately, the same problems still persist when I navigate to the pages above. What’s troubling is when I run the same code through ruby script/console it functions properly. The error is listed below.

    NoMethodError in Photos#show

    Showing app/views/photos/show.rhtml where line #15 raised:

    undefined method `small_avatar’ for #<user:0x3350694>

    Extracted source (around line #15):

    12:


    13:


    14:
    15: <% user.small_avatar%>
    16:

    17:


    18:

    RAILS_ROOT: script/../config/..
    Application Trace | Framework Trace | Full Trace

     
    May 9, 2008
    Avatar EldonAlameda 189 post(s)

    Topic: Simple Blog Discussion / typo install error

    Hi Ron,

    A few initial questions for you.

    1. What operating system are you installing typo on (i.e windows, mac, linux)?
    2. What’s the specific error message you get when running?
    3. What’s the ouput you get when you run “gem list—local”?

    As for location – Typo will install itself into a new directory within the current directory that you run the command from.
    So if you were in /home and ran “typo install my_blog” – Then typo will create a new directory named my_blog (i.e. /home/my_blog ) and install typo in it.

     
    May 9, 2008
    Avatar ron 1 post

    Topic: Simple Blog Discussion / typo install error

    Hi,

    I’m trying to set up a blog using Typo with the instructions in the book. I’ve got typo installed correctly, but when I type typo install there are two problems:

    1) My server doesn’t recognize the command

    2) I’m not sure what part of the command specifies the location

    I’m wondering if there’s something I’m overlooking here…I searched through the typo documentation and couldn’t find anything about installing Typo from a script..

     
    Apr 11, 2008
    Avatar EldonAlameda 189 post(s)

    Topic: Cool Stuff / ModRails

    ModRails has been released as a beta!!!

    http://www.modrails.com/

    Very excited to try this out (even if it does mean I’ll have to start charging less for Rails server setup) ;-)

     
    Apr 9, 2008
    Avatar Lei 14 post(s)

    Topic: Cool Stuff / importing data into sqlite3 table

    Thank you for being so helpful, I’ve just loaded the data :D

     
    Apr 9, 2008
    Avatar Lei 14 post(s)

    Topic: Cool Stuff / importing data into sqlite3 table

    Thanks, I’ll definitely have a look at the tutorial. For now, I think I’ll just do it through migration, though I have to first figure out how to write a proper regular expression for it.

    Next Page

    Pages: 1 2 3 4 5 6 7 8 9 10 11 ... 17