similar to: ActiveRecord: why does 'self.name' and 'name' both work?

Displaying 20 results from an estimated 11000 matches similar to: "ActiveRecord: why does 'self.name' and 'name' both work?"

2009 Feb 19
0
friendly_id / acts_as_referenced conflict?
Hi, I''m using acts_as_referenced to generate unique references: # property.rb class Property < ActiveRecord::Base acts_as_referenced :referenced_column => "permalink" end I would now like to use friendly_id to create seo friendly URLs instead of using the id. I now have: # property.rb class Property < ActiveRecord::Base acts_as_referenced :referenced_column =>
2010 Jun 12
2
Redirections, Duplicate Content & Permalinks
Hi, Recently I''ve looked at trying to get a permalink system up to increase my site''s ranking in google (and to have nice looking URLs); however I''ve been very worried about google and duplicate content. I currently already have a "flaw" in my site, in which if you go to mysite.com/tutorials/ID it will bring you to the same place as
2008 Apr 30
3
pretty url
I want to write a permalink like /year/month/day/title, code is as follows: self.permalink = "#{now.year}/#{now.month}/#{now.day}/#{title}" in the view, I use restful url post_path(@post). And in the html source code, the url is /posts/2008%2F4%2F30%2FTest You can see, the ''/'' is replaced by "%2F", which is not I expect. How not to replace the
2006 Apr 11
4
wrong number of arguments (2 for 1)
Hi, Im having trouble figuring out how to query my database in ruby and i''m hoping someone can help me out. I''d like to find all my departments that match a permalink passed from the url. The department must also match a particular category, also passed through the url. I have written the following code. But unfortunatley I get an error "wrong number of arguments (2 for
2006 Mar 24
3
String manipulation
I need to make some nicenames from my post titles, like: - convert spaces to "-" - delete all the !,?,commas,.,;.:,* from the string How can I do? Sorry for the noob question... Oh, and another thing... How can I make permalink this way: Not .../blog/show/4 but .../category/nicename ? Thankyou. -- Posted via http://www.ruby-forum.com/.
2008 Mar 18
0
Major issues with ActiveRecord callbacks in BackgroundRb r324
Hi there I''ve been running BackgroundRb in production for a few months now. Recently we added encryption onto some of our ActiveRecord fields by hooking in the before_save and after_save callbacks, like: class MyCallback def initialize(attr_names) @attr_names = attr_names end def before_save(model) @attr_names.each do |attr_name| next if
2006 Mar 25
1
routes mapping, subdomains and page-caching
Each of its own is no problem, but the combination of them is confusing my head ! I want to to map in routes.rb an url for an article which is identified by its permalink. The permalink is unique per subdomain. Has anybody done that and can post an example ? Should I do subdomain filtering in routes.rb so I can get page-cachabled URLs (and URL rewriting in Lighttpd form subdomain-urls to
2011 Jan 24
2
Seeing what has changed in ActiveRecord
I have a callback (before_save) that I want to trigger only when certain fields within a record have changed. For example given a user record with ''username'', ''password'' and ''date_of_birth'' I would like the callback to do something only when the ''username'' or ''password'' changes or when the
2011 Jun 10
2
Problem with a web page at gmane.
http://permalink.gmane.org/gmane.comp.search.xapian.general/6933 For some reason the links on that page include the trailing periods so clicking on them will give you a 404 error. Can this be fixed? Thanks, Jim.
2008 Dec 04
1
permalink_fu and Rails 2.2.2
Hi, Since I have updated my Rails gems to 2.2.2, when I create a new entry in DB which has a permalink I get the following error message: uninitialized constant ActiveSupport::Multibyte::Handlers Do you know if permalink_fu is compatible with Rails 2.2.2? Is there an option I have forgotten to pass to make it work correctly? -- Posted via http://www.ruby-forum.com/.
2013 Jan 24
2
libvirt -- add virtio-scsi disk with scsi-generic
Hi, Paolo, All, I read "virtio-scsi support proposal v2"(http://permalink.gmane.org/gmane.comp.emulators.libvirt/50428). Try to add a virtio-scsi with scsi-generic like this: <hostdev type='scsi'> <source> <adapter name='scsi_host0'/> <address type='scsi' bus='0' target='0' unit='0'/>
2012 Aug 30
1
segfault in gplots::heatmap.2
Hi all, I am taking this over from r-help (see http://permalink.gmane.org/gmane.comp.lang.r.general/273985). I experience a segfault when calling gplots::heatmap.2(), but only when certain other packages are loaded. I am not sure for the correct place to send this bug report. Should I send it to the package maintainers directly? If R-help is the wrong place, please feel free to direct me to
2006 Jun 08
2
how to add plugin to ActiveRecord
I''m trying to set a date field''s day to the last day of the month before I save it. I can do this successfully now using this code: class Account < ActiveRecord::Base def before_save self.exp_date = last_day_of_month(self.exp_date) end # Returns a Date object set to the last day of the current month def last_day_of_month(date = Date.today) next_month_str
2006 Feb 01
1
ActiveRecord::FileSystem???
Rails makes working with databases easy with ActiveRecord::Base. Has anyone written a rails system for working with files so we can do things like: class User < ActiveRecord::FileSystem root_directory "c:/uploads" file_permissions directory_permissions validates_filetype validates_filesize validates_filename before_save I know about file_column, but I don''t
2009 Mar 17
4
Preventing a submitted hash from ActiveRecord DB store
Hi all, I have a multi model form (Project with many tasks) and I want to prevent a task from being saved to the DB if it is empty ie. if there is no i/p for that task from the user. I tried the following class Task < ActiveRecord::Base before_save :check_if_empty ... def check_if_empty self.destroy if description.blank? end but i get this TypeError in ProjectsController#create
2008 Feb 25
3
customize resource routes
Hi all, I have this application that lists videogames, which i am rewriting to follow REST. I need to have this url : /games/xbox360/halo-3 ( map.connect "/ games/:platform_id/:permalink",:controller => "games",:action => "show" ) This is no problem with map.connect, but with map.resources i can not make this. map.resources :games do |game|
2006 Jul 06
2
Custom init. of ActiveRecord objects - best practices
All, I''m wanting to initialize an ActiveRecord object. I understand that there is a method called after_initialize that appears to get called right after the ActiveRecord object is instantiated. Is after_initialize a Ruby thing or a Rails thing? Where is after_initialize documented? Can I pass parameters to it? If so, how? I want to initialize the "belongs_to" attribute of
2006 Jul 06
6
Help with overriding / overwriting date values in ActiveRecord to accept Euro Style Date from a Textbox
Hi guys, I''m trying to make an AR model which accepts a string data (from a text input) in euro date format eg <input .... value = "23/01/2006"> ( 23 Jan 2006) Reading the example from RDoc... i tried to overwrite/overload/override the = function to write in the date.. Cant get it to work because .. i dont knoe what format should it accept.. i''ve tried
2010 Jul 26
4
Changing the model_path.
Hi, I''m new to RoR, but currently need to make some changes to my site to implement permalinks. Whenever I do a link, I use: category_path(category) and then the to_param permalinks it. The previous piece of code would link you to / categories/CategoryPermalink; the trouble is I don''t want it to be / categories, I just want it to be /PERMALINK. Then I''m getting into
2008 Mar 11
6
saving an ActiveRecord without trigging the callbacks
Hello, How can I save an ActiveRecord without trigger before_save, after_save, etc? Thanks for the help. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group,